From nobody Fri Jan 28 19:21:28 2022 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 AD30019892B3; Fri, 28 Jan 2022 19:21:28 +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 4JlnPh4WLpz3Kw1; Fri, 28 Jan 2022 19:21:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643397688; 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=UefaeAk95aP1L3e2pMdQFzw9i80qZI40Zt++r8iFBqs=; b=e7/egUyjo8NCD+rM7y1U6wRcT9x6PYEykBIG+Nn2av40h78YqdU1+OvPwlwL9KizCKNZTo glddS6oDOFimUDghmE19XY6TB0i0c7VBgZshjSxThGXYJyG1Kw+5zxv2hz4nIPSTpL2Bg4 Uzxd5g8sOEyWw03gESbXSMibFuLzQ+9O7pq2fJ++ODggkuUQr+9LJpVwwbaQKN0/SZID99 icKq7iKkO+o72eXv3IpCP7M2M2BL+fuT0g9LoiSoK3UfXX1teE0S0D/wR6Ywg2yLVi9fVV /NC76t0nm9yPfIk8W7d+w8sIZLNBH1rA/oQR3RtAbDe7HbUhAnjXipJ4IYNcJw== 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 7C43E2FDF9; Fri, 28 Jan 2022 19:21:28 +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 20SJLSMP068900; Fri, 28 Jan 2022 19:21:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20SJLSa7068899; Fri, 28 Jan 2022 19:21:28 GMT (envelope-from git) Date: Fri, 28 Jan 2022 19:21:28 GMT Message-Id: <202201281921.20SJLSa7068899@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: ffc1cc95e78e - main - GEOM: Relax direct dispatch for GEOM threads. 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=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ffc1cc95e78ec05a3e1a0aed869e33a44d9f6641 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643397688; 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=UefaeAk95aP1L3e2pMdQFzw9i80qZI40Zt++r8iFBqs=; b=BKW4XgFeLAjoSWOYpBfFBsuLy4/vkl/ZQDfrQqjyY66onm6JPW+FYRIHFp7D5jUP44xVlo 8ULgCa/vETQciITwapOZPX31e57xOoRSDqaMaq18fTwDtB92wyHwUitYQuygXEIqfNb5R+ AyCKWbkmkOSuimvX0M/aY39ZcNBdtvX6YburlQyoaBf22VOXTKG8PgLFGqz0kaUM2+N07P IA8/NmsiL3v+lmVsbtCsKjUcorkqBiYTsfS5cB+NPsWm3HGPxAEwFul9/62JUY+5s5+E5V JnIrwx8cIVI7xBs8CGdLZMigWYCpczSd9UENq+ZGHDWaSIHWJ8JhNXNnbm76lA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1643397688; a=rsa-sha256; cv=none; b=tY4iQEpQQwq4vs/BELYag1ETH7/KYaUDEWZWc2akN8Ib2ryCTagAA4GThXN4v81qvAvyvu fINgtvZgTYrL+OKx2ohobUiacCF2C0uXF/QGfGmiK1ZBOH+lqWSw7CWUFvgYb36OiLR8k3 H385FwxrFbqxS7ZvT9bUmgC5H2MWRVRLd//E8U43u+A9+j/7c9SJ3CBdCFEKav0zxdxTMg XywxneJewaz9DXpf3m5KBBx1Y06il+44d/wktzy6vXf6/DxX2b7iDJwk+MuPPcEr5z+aHt JqYvacQbrAbELK3N/+KcysSArQANz00HU+4XWR5gecJYE7sBQDoZLVATA9+72w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=ffc1cc95e78ec05a3e1a0aed869e33a44d9f6641 commit ffc1cc95e78ec05a3e1a0aed869e33a44d9f6641 Author: Alexander Motin AuthorDate: 2022-01-28 19:12:29 +0000 Commit: Alexander Motin CommitDate: 2022-01-28 19:21:21 +0000 GEOM: Relax direct dispatch for GEOM threads. The only cases when direct dispatch does not make sense is for I/O submission from down thread and for completion from up thread. In all other cases, if both consumer and producer are OK about it, we can save on context switches. MFC after: 2 weeks --- sys/geom/geom_int.h | 2 ++ sys/geom/geom_io.c | 4 ++-- sys/geom/geom_kern.c | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/geom/geom_int.h b/sys/geom/geom_int.h index 9f2a011b23f0..67c46d715885 100644 --- a/sys/geom/geom_int.h +++ b/sys/geom/geom_int.h @@ -69,6 +69,8 @@ void g_io_schedule_up(struct thread *tp); /* geom_kern.c / geom_kernsim.c */ void g_init(void); +extern struct thread *g_up_td; +extern struct thread *g_down_td; extern int g_shutdown; extern int g_notaste; diff --git a/sys/geom/geom_io.c b/sys/geom/geom_io.c index a5cb8c7279e4..e893793ec385 100644 --- a/sys/geom/geom_io.c +++ b/sys/geom/geom_io.c @@ -561,7 +561,7 @@ g_io_request(struct bio *bp, struct g_consumer *cp) direct = (cp->flags & G_CF_DIRECT_SEND) != 0 && (pp->flags & G_PF_DIRECT_RECEIVE) != 0 && - !g_is_geom_thread(curthread) && + curthread != g_down_td && ((pp->flags & G_PF_ACCEPT_UNMAPPED) != 0 || (bp->bio_flags & BIO_UNMAPPED) == 0 || THREAD_CAN_SLEEP()) && pace == 0; @@ -653,7 +653,7 @@ g_io_deliver(struct bio *bp, int error) direct = (pp->flags & G_PF_DIRECT_SEND) && (cp->flags & G_CF_DIRECT_RECEIVE) && - !g_is_geom_thread(curthread); + curthread != g_up_td; if (direct) { /* Block direct execution if less then half of stack left. */ size_t st, su; diff --git a/sys/geom/geom_kern.c b/sys/geom/geom_kern.c index 4b7219591dce..429bd7a05a4b 100644 --- a/sys/geom/geom_kern.c +++ b/sys/geom/geom_kern.c @@ -61,8 +61,8 @@ MALLOC_DEFINE(M_GEOM, "GEOM", "Geom data structures"); struct sx topology_lock; static struct proc *g_proc; -static struct thread __read_mostly *g_up_td; -static struct thread __read_mostly *g_down_td; +struct thread __read_mostly *g_up_td; +struct thread __read_mostly *g_down_td; static struct thread __read_mostly *g_event_td; int __read_mostly g_debugflags;