From nobody Wed Dec 29 13:47:44 2021 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 A07341919CDD; Wed, 29 Dec 2021 13:47:44 +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 4JPCQS2nNkz3l4v; Wed, 29 Dec 2021 13:47:44 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 3F77525B5E; Wed, 29 Dec 2021 13:47:44 +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 1BTDliWN041343; Wed, 29 Dec 2021 13:47:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BTDliCJ041342; Wed, 29 Dec 2021 13:47:44 GMT (envelope-from git) Date: Wed, 29 Dec 2021 13:47:44 GMT Message-Id: <202112291347.1BTDliCJ041342@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 626d6992ca6d - main - Move fork_rfppwait() check into ast() 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: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 626d6992ca6deff3c4738a01e8c4798989cc9ec7 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1640785664; 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=zJQFcCjm4LOJEcZJ53jRwnjurhBzJ77O9f3QOO3vAnw=; b=NnmCaDHWHEEYTF+hrbTQLgHBaIv9hQWgMJtBG3IJVlggiciR26d8bCSPXHWcy0VXB2F6ai e/D9Q9pTgHtdDR3SEq1AbNy6qblqDsKH0bZon7Nxh7xUDYev2oYVqnMZtFhLwiUsAw2Yjp owF7ITJ/mQSdKLSHxxoBfHbxi//n2uc9koBRTHn10SCOqaemDhd3AIN9aEsjVzDLz/To3H bZh7PkmTqlKGShTSdUQo3YVhgONKT5PGElWZ+QoctB7YVw+/WwVQk67kgxz/A3LghACWKa sPeTtlKeSIjH73d4cs4uN3fSutpkmA8u4wbNvaJW1c7Pg8WAIF+nfWK2uDEHcw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1640785664; a=rsa-sha256; cv=none; b=KSZF1JmGKeJWodMiTHCwFoldovPTFwe0BpNLBIn0WMriXMquIMeuvqcqdzvfxBfZZzZUXq PjV2eXwoqYFYPuRSrNNNG9/PSPok8nFWPO2K/vC567rG2ahmSEPk/59CgjjU4GqIvkRs9r O5Qqa9So+G89uVaFcNYHgt+e6Y7HhFiRqIc/qbAoECjo/6E0TfS5P31etmCaXMHVZU0c0A vThunTA+KoRPRHzPMrX7xFQhStvIwmACUR/wzCIxS9hS4fMyGpDm2RlzgU7Wu9AykDMer1 GbK2U3gwGhPWaClapE3YZvApj2dW12NK5VNI8Q838RdeyAEAYfvlCNjemKRrmA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=626d6992ca6deff3c4738a01e8c4798989cc9ec7 commit 626d6992ca6deff3c4738a01e8c4798989cc9ec7 Author: Edward Tomasz Napierala AuthorDate: 2021-12-26 17:22:16 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-12-26 17:22:21 +0000 Move fork_rfppwait() check into ast() This will always sleep at least once, so it's a slow path by definition. Reviewed By: kib Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D33387 --- sys/kern/kern_fork.c | 6 ++++++ sys/kern/subr_syscall.c | 3 --- sys/kern/subr_trap.c | 2 ++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 5b518a0183d8..a6d83fc8049d 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -484,6 +484,12 @@ do_fork(struct thread *td, struct fork_req *fr, struct proc *p2, struct thread * */ thread_lock(td); sched_fork(td, td2); + /* + * Request AST to check for TDP_RFPPWAIT. Do it here + * to avoid calling thread_lock() again. + */ + if ((fr->fr_flags & RFPPWAIT) != 0) + td->td_flags |= TDF_ASTPENDING; thread_unlock(td); /* diff --git a/sys/kern/subr_syscall.c b/sys/kern/subr_syscall.c index dacd82f4c466..fa5dcb482f2c 100644 --- a/sys/kern/subr_syscall.c +++ b/sys/kern/subr_syscall.c @@ -285,7 +285,4 @@ syscallret(struct thread *td) td->td_dbgflags &= ~(TDB_SCX | TDB_EXEC | TDB_FORK); PROC_UNLOCK(p); } - - if (__predict_false(td->td_pflags & TDP_RFPPWAIT)) - fork_rfppwait(td); } diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c index 2b86fe75776f..ec8f686a497d 100644 --- a/sys/kern/subr_trap.c +++ b/sys/kern/subr_trap.c @@ -259,6 +259,8 @@ ast(struct trapframe *framep) if (PMC_IS_PENDING_CALLCHAIN(td)) PMC_CALL_HOOK_UNLOCKED(td, PMC_FN_USER_CALLCHAIN_SOFT, (void *) framep); #endif + if ((td->td_pflags & TDP_RFPPWAIT) != 0) + fork_rfppwait(td); if (flags & TDF_ALRMPEND) { PROC_LOCK(p); kern_psignal(p, SIGVTALRM);