From owner-svn-src-head@freebsd.org Tue Oct 6 02:03:35 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 46C8843771F; Tue, 6 Oct 2020 02:03:35 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4C513B3k3Tz3Xb5; Tue, 6 Oct 2020 02:03:34 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 814E85C013F; Mon, 5 Oct 2020 22:03:33 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 05 Oct 2020 22:03:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsco.org; h= content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=fm1; bh=E GeGg5fc8OsZ4dyBbdi7m4txftTtZk/zOoQB0+dnL3g=; b=xim1MKt4hs9t0aQko hPcS026qTmQBnlGaRPx95kBasjzDXVVX7c3TFUIvFDQu+w5YepgZcm4LnjNnGU5+ S537SLQOYk+FMah+RtQzZtYUBrw56f5n18Mg6Y9LEvLGibA7uui6tFFKpIj5aoBN 2SokCAQAusl51uywuxfcq8f4qPXWoTsP++zd5DfHPdTWRmGg/2gOCv7sGc5x47zO fCRQM56mzBEvXLmK1JfUJlVSycHnQubEP+KLQZpWXgm/fE6QG8ozqEglNkaOA5GM rz3lLHjOF7VpbUmo8DZ+ioV/rdn7x9vllA+QDXaU9CvvDGmvdVeb5X4aa5y7PsHK WARNQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=EGeGg5fc8OsZ4dyBbdi7m4txftTtZk/zOoQB0+dnL 3g=; b=gQ+qVyuwZwX5uAn1d8O2ZR6+wBAhZhmscZV75p6TQjGLZY4YXY1M0oBeY 1agm7naNHOHQaZACtBO8OJE2HaWuXfCa/epPEbr7a/EbfJpyE8EpIQ+91SewLlMk vbCuZJGSrOBAmf2GJiaEpCSZFjFqKz8qiExh7JOiweJyK/hpbUXbhJlV4fhDDMOJ YyskS4bgm3dCQfKQICnsnMjjaQ3y1fFphvPEYMNZIr+C68fM1z9viURAmpCNXd9C +9IvxF33NULkzyPgqzigAhc69TJwbZffTZ8RhJHDjaI0fHQU9fQb9WWqBzQr6wNr Ddfly6ki0VhXK74RbrVRHrZ6cBytA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrgeefgdehgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpegtggfuhfgjfffgkfhfvffosehtqhhmtdhhtdejnecuhfhrohhmpefutghothht ucfnohhnghcuoehstghothhtlhesshgrmhhstghordhorhhgqeenucggtffrrghtthgvrh hnpeefjeeggfejhffgtdejveejkeegveeileeuheejgfduteevgfdttefggfeggfdvgeen ucfkphepkedrgeeirdekledrvddufeenucevlhhushhtvghrufhiiigvpedtnecurfgrrh grmhepmhgrihhlfhhrohhmpehstghothhtlhesshgrmhhstghordhorhhg X-ME-Proxy: Received: from [192.168.0.114] (unknown [8.46.89.213]) by mail.messagingengine.com (Postfix) with ESMTPA id 979113064680; Mon, 5 Oct 2020 22:03:32 -0400 (EDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.1\)) Subject: Re: svn commit: r366429 - in head/sys: kern sys From: Scott Long In-Reply-To: Date: Mon, 5 Oct 2020 20:03:31 -0600 Cc: Konstantin Belousov , Rick Macklem , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <33690A29-E145-44B7-AA9B-5FDE05F5C459@samsco.org> References: <202010041633.094GXg4l044462@repo.freebsd.org> <20201005011833.GI2643@kib.kiev.ua> To: Mateusz Guzik X-Mailer: Apple Mail (2.3608.120.23.2.1) X-Rspamd-Queue-Id: 4C513B3k3Tz3Xb5 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=samsco.org header.s=fm1 header.b=xim1MKt4; dkim=pass header.d=messagingengine.com header.s=fm1 header.b=gQ+qVyuw; dmarc=none; spf=pass (mx1.freebsd.org: domain of scottl@samsco.org designates 66.111.4.26 as permitted sender) smtp.mailfrom=scottl@samsco.org X-Spamd-Result: default: False [-2.76 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ip4:66.111.4.26]; RWL_MAILSPIKE_GOOD(0.00)[66.111.4.26:from]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_COUNT_THREE(0.00)[4]; DKIM_TRACE(0.00)[samsco.org:+,messagingengine.com:+]; NEURAL_HAM_SHORT(-0.61)[-0.611]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:11403, ipnet:66.111.4.0/24, country:US]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_IN_DNSWL_LOW(-0.10)[66.111.4.26:from]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.004]; R_DKIM_ALLOW(-0.20)[samsco.org:s=fm1,messagingengine.com:s=fm1]; FREEFALL_USER(0.00)[scottl]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.04)[-1.043]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[samsco.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; FREEMAIL_CC(0.00)[gmail.com,uoguelph.ca,freebsd.org]; MAILMAN_DEST(0.00)[svn-src-all,svn-src-head] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Oct 2020 02:03:35 -0000 > On Oct 5, 2020, at 1:35 PM, Mateusz Guzik wrote: >=20 > On 10/5/20, Konstantin Belousov wrote: >> On Sun, Oct 04, 2020 at 09:06:02PM +0000, Rick Macklem wrote: >>> Mateusz Guzik wrote: >>>> Why is the process lock always taken? It looks like both routines = just >>>> check a thread-local flag, so perhaps this can get away without >>>> serializing this process-wide? >>> I did spot this slight difference between the initial version of >>> sig_intr() and >>> this one. At least w.r.t. copy_file_range(2), the call happens >>> infrequently >>> enough that the overhead of acquiring the lock is not significant. >>>=20 >> Yes, the function should not be on any frequent path. >>=20 >> That said, all signal delivery to process is covered by the process = lock, >> so checks under process lock make the advisory answer provide less = false >> negatives. If considered too importand in some cases (when ?), the >> following >> patch can be applied. >>=20 >> diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c >> index 8108d4cb3a5..ed4dd52b66d 100644 >> --- a/sys/kern/kern_sig.c >> +++ b/sys/kern/kern_sig.c >> @@ -3212,6 +3212,9 @@ sig_intr(void) >> int ret; >>=20 >> td =3D curthread; >> + if ((td->td_flags & (TDF_NEEDSIGCHK | TDF_NEEDSUSPCHK)) =3D=3D = 0) >> + return (0); >> + >> p =3D td->td_proc; >>=20 >> PROC_LOCK(p); >>=20 >=20 > I presume copy_file_range will not be the only consumer going forward. >=20 > The default for all new code should be to avoid locks or other atomics > if it can be helped, otherwise it's just never ending whack-a-mole and > this is bound to become a bottleneck at some point. >=20 > So happens process lock is already quite contended (e.g., when running > poudriere) and adding to it is the wrong way to go. >=20 > --=20 >=20 Agreed. After all of the work that=E2=80=99s been done in the last 20 = years to make SMP work well on FreeBSD, I=E2=80=99m not sure why it=E2=80=99s ok to = wave ones hand and say that serializing locks are still ok, or that they don=E2=80=99t = matter. The bias needs to be against adding more serialization points, even if it=E2=80=99s not = convenient. Scott