From nobody Wed Mar 29 09:19:09 2023 X-Original-To: dev-commits-src-main@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 4PmgwY3XP0z42H8n; Wed, 29 Mar 2023 09:19:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PmgwY33dKz3r2R; Wed, 29 Mar 2023 09:19:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1680081549; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dDn8Z31W3hvIg1NQ7Xca9hkJlA+wF5Mws1yjBq9nIyI=; b=Wf6f/FddrP4E7a3JDJkXXz/16gvhjnltESFy7w9sWi6bP1ihSH3GivPhoORVpNdLxmgJNY GBPFsxlpozDU8JxNI7STwAG6LXdMU5MUaMsh3GR+/9alMY4QebCDkyNrK1ooYDNRunlINi YfiY7ETO7uiv/KHvRF/knZ/4yFtseDdnp6iKIg2obvSp+0lIX30yFHGmzNXR96pzt4/dwM w9PkwdhUWG+5Ye90YcscrplN0bFWZ6QmmSJl2EhiF9d8Hej3O8VTXMqx3TjvCrmEQUZQjb dI4IqM3h7/yz0q6ANrrTN0d+Y8b82sC7FeL1r9ANUzKN8X72Ma5wjmP6qy7Beg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1680081549; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dDn8Z31W3hvIg1NQ7Xca9hkJlA+wF5Mws1yjBq9nIyI=; b=AOo2yZdyCwhSTB0PeamRfA4vVctuzLd3rn2Y+Tvi60Z/GCCDIGuESJI6Ae1+53z9sCDlCa 8BkGNKqGnfdNhfUMzR2pOjbSf6sNMStn8p9x/AXbFaD0lsvK4GQkUmnFg2D/91utcQkVEx gQr9YrQbfZlcSsBYjiSaP716Gbo5UIXKyHJU2EMRTdQ/fJ58jXyb+f4dKpXqI+NV+Agmdc YYIBTXBcw2bUz+giFTlvx+B8eUA+sTROrAKehlqxIZkWo2RfcrXk0xOgRHLokKfbnszMet lMMj8p9H4T7uWy+UmrdMxf2fN85D9YOtJrmMnBAmv04M+vAgqJxmI+BaMThNGg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1680081549; a=rsa-sha256; cv=none; b=yzBaxtlTNstyWP9n9Lne5P/FfAu3iMb3ckE/zIXCybeAqCK0g2jf7XjW0yvQrxoopDcnJg a3T81KDcpN037vuoesgt6muvKvUIni1vMamIBimBaqdreR/nrwtg6j1bw/f5Cq5EOz/G8N /2ONE+lMWqUyodAxFGMmSRLC4CFG7Odr0pHf5OXb5VtbulZxeuOyqnkRoUCC6wZpCSY8xo AzJHzQIN4AgiuKWYPiwrRfLv//j04BQ1+bOi8yP9xgFiTKV2BlrmfuQhHaChV82MgHOmGE QNqASTaEEA1nUrxbrdXlQbsBPzuYEUELkor64QGMbRTCPJGC31TNQEyl1UiB6A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PmgwY1czGzQ0p; Wed, 29 Mar 2023 09:19:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 32T9J9Ur085151; Wed, 29 Mar 2023 09:19:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32T9J9Z5085150; Wed, 29 Mar 2023 09:19:09 GMT (envelope-from git) Date: Wed, 29 Mar 2023 09:19:09 GMT Message-Id: <202303290919.32T9J9Z5085150@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 80cf427b8dc1 - main - proc: shave a lock trip on exit if possible List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 80cf427b8dc18bc5c26fed6d07bc5c5eda4545b0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N 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); + } /* * killjobc() might drop and re-acquire proctree_lock to