From nobody Wed Mar 29 09:32:01 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PmhCS55Pqz42J4t; Wed, 29 Mar 2023 09:32:04 +0000 (UTC) (envelope-from dchagin@heemeyer.club) Received: from heemeyer.club (heemeyer.club [195.93.173.158]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4PmhCR6tzLz3sqF; Wed, 29 Mar 2023 09:32:03 +0000 (UTC) (envelope-from dchagin@heemeyer.club) Authentication-Results: mx1.freebsd.org; none Received: from heemeyer.club (localhost [127.0.0.1]) by heemeyer.club (8.17.1/8.16.1) with ESMTP id 32T9W1FA032098; Wed, 29 Mar 2023 12:32:01 +0300 (MSK) (envelope-from dchagin@heemeyer.club) Received: (from dchagin@localhost) by heemeyer.club (8.17.1/8.16.1/Submit) id 32T9W1GX032097; Wed, 29 Mar 2023 12:32:01 +0300 (MSK) (envelope-from dchagin) Date: Wed, 29 Mar 2023 12:32:01 +0300 From: Dmitry Chagin To: Mateusz Guzik Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 80cf427b8dc1 - main - proc: shave a lock trip on exit if possible Message-ID: References: <202303290919.32T9J9Z5085150@gitrepo.freebsd.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202303290919.32T9J9Z5085150@gitrepo.freebsd.org> X-Rspamd-Queue-Id: 4PmhCR6tzLz3sqF X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:61400, ipnet:195.93.173.0/24, country:RU] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N On Wed, Mar 29, 2023 at 09:19:09AM +0000, Mateusz Guzik wrote: > The branch main has been updated by mjg: > > URL: https://cgit.FreeBSD.org/src/commit/?id=80cf427b8dc18bc5c26fed6d07bc5c5eda4545b0 > > commit 80cf427b8dc18bc5c26fed6d07bc5c5eda4545b0 > Author: Mateusz Guzik > AuthorDate: 2023-03-29 08:45:46 +0000 > Commit: Mateusz Guzik > CommitDate: 2023-03-29 09:19:03 +0000 > > proc: shave a lock trip on exit if possible > > ... which happens to be vast majority of the time > --- > sys/kern/kern_exit.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c > index 3f64343aea0e..a92d5cc0f642 100644 > --- a/sys/kern/kern_exit.c > +++ b/sys/kern/kern_exit.c > @@ -477,9 +477,11 @@ exit1(struct thread *td, int rval, int signo) > sx_xunlock(&allproc_lock); > > sx_xlock(&proctree_lock); > - PROC_LOCK(p); > - p->p_flag &= ~(P_TRACED | P_PPWAIT | P_PPTRACE); > - PROC_UNLOCK(p); > + if ((p->p_flag & (P_TRACED | P_PPWAIT | P_PPTRACE)) != 0) { > + PROC_LOCK(p); > + p->p_flag &= ~(P_TRACED | P_PPWAIT | P_PPTRACE); > + PROC_UNLOCK(p); > + } just out of curiosuty, is this can be replaced by a single atomic_clear_rel ? > > /* > * killjobc() might drop and re-acquire proctree_lock to