From nobody Fri May 24 15:40:42 2024 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 4Vm8Q21fmgz5LHB3; Fri, 24 May 2024 15:40:42 +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 4Vm8Q217xLz4vvd; Fri, 24 May 2024 15:40:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1716565242; 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=P5GephaTSaysz20CG7aL0oE19QCWCXm+wq+mStM/r3U=; b=xIwM5NUg3aB5iXRZTqLl+CPzF40svxkuouWBebHWJN34z/8j2/iv8Vw+NhDex3HMmtIun5 vwBiDIMXeS5FeQGh8SJYdAnIyvfqyF0XdIBCKnCNDjCPNz683h6kb/OWlsDNFJrlUH/K0v u2QwRQVT4HRnXHOlv6Bm/7rhT+Qf37Xn3GEjFpnritOMI+vUfuDN11ZDPpQ0PXz5mOqar9 X0TdAMeiKhwUVDLYxuu//S99G2Q5bTMHo8HjQGPD1n+FR14NdN983K9uviTkMvGwQ3nKec tyb/NURK57VJpRmtka/yY7Q0GKU6TuAsm3fhWMV1rtNq7jYVTEW2CkAZBWhDKA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1716565242; a=rsa-sha256; cv=none; b=JhyOV4JLp6462rYaLz+766wjeOWRX17ePSUsIzYSuyffEv0plJkIb6fepoHNR5E2YD8DCU UyfWrGeuuin2aB21+LsLPzaic5GI7QU+GAg+eDD7oqc7ilqjrPV2CLpq0GUaArWbJeg+OZ z8umsqibR1vrhLPda7pCkYr80w4DeHYOlR6z2rlJQhl1EMQS4/rhaB9+LlNqYfVfnP9wDN +IkiBf+nk0g+qUlmq5RpuvwZuQpwPPeqI36vHSc9eCwCTi8hhW2KU0OYei4UVeC3Ouaghk CEGV4rVh9PFb48aY3gyBaw16q5s+o1/njGPs+576AqgeZvuI0mTYL3N3ts7Ehw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1716565242; 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=P5GephaTSaysz20CG7aL0oE19QCWCXm+wq+mStM/r3U=; b=jUHRT2G4bDjKGsaabid6g9Y7Fu1mNJgOmnH3sZ5lEStmAm+6+JqfwnQyLvI4xleCCowGrz 3tjLDCW7e3bDnBusXlQuCXcz93N666YjY6pJdQjOyWQO9ahWlt0cRnKIX60JOJeLzYLrNI ihvJHIQc2AGDky93PBarMrRjvmHIP7sgmJ8+RdYWXyJkCMSHvD0LH0oFwtL2XHBU1DToSM /nbRgNRMRhjopepAqkFtPhlHCba9RRa/PDB5moxMJBMqPIoSRwjBZuTtfO2U7rsuGjhSGa /46u8YqWdaLMqqioZyJyUFyhARlMJEzt3Tr+gZ5yo9GhJcjUyl8QqAuymOxcNA== 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 4Vm8Q20lzDzf6p; Fri, 24 May 2024 15:40:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 44OFegP7012223; Fri, 24 May 2024 15:40:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44OFeg8m012220; Fri, 24 May 2024 15:40:42 GMT (envelope-from git) Date: Fri, 24 May 2024 15:40:42 GMT Message-Id: <202405241540.44OFeg8m012220@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 6d83b381860b - main - geom_io: Shift to pause_sbt to eliminate bogus min and update comment. 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: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6d83b381860bd8a1ea2043e26bdf2cf2ed640a38 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=6d83b381860bd8a1ea2043e26bdf2cf2ed640a38 commit 6d83b381860bd8a1ea2043e26bdf2cf2ed640a38 Author: Warner Losh AuthorDate: 2024-05-24 14:31:55 +0000 Commit: Warner Losh CommitDate: 2024-05-24 14:31:55 +0000 geom_io: Shift to pause_sbt to eliminate bogus min and update comment. Update to eliminate bogus min to ensure 0 was never passed to pause. Instead, requrest 1ms with an 'infinite' precision, which defaults to whatever the underlying time counter can do. This should ensure we run fairly quickly to start processing done events, while still giving a small pause for the system to catch its breath. This rate limiter still is less than ideal, and this commit doesn't change that. It should really have no functional change: it just uses a better interface to express the desired sleep. Sponsored by: Netflix Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D45316 --- sys/geom/geom_io.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/sys/geom/geom_io.c b/sys/geom/geom_io.c index 25b3908e5fb5..02c8ed9f2bae 100644 --- a/sys/geom/geom_io.c +++ b/sys/geom/geom_io.c @@ -809,20 +809,17 @@ g_io_schedule_down(struct thread *tp __unused) biotrack(bp, __func__); if (pace != 0) { /* - * There has been at least one memory allocation - * failure since the last I/O completed. Pause 1ms to - * give the system a chance to free up memory. We only - * do this once because a large number of allocations - * can fail in the direct dispatch case and there's no - * relationship between the number of these failures and - * the length of the outage. If there's still an outage, - * we'll pause again and again until it's - * resolved. Older versions paused longer and once per - * allocation failure. This was OK for a single threaded - * g_down, but with direct dispatch would lead to max of - * 10 IOPs for minutes at a time when transient memory - * issues prevented allocation for a batch of requests - * from the upper layers. + * There has been at least one memory allocation failure + * since the last I/O completed. Pause 1ms to give the + * system a chance to free up memory. Pause time is not + * scaled to the number of I/O failures since they tend + * to cluster and the number is not predictive of how + * long a pause is needed. + * + * Older versions had a longer pause, which limited the + * IOPS to 10, which prolonged memory shortages that could + * be alleviated by I/O completing since it eliminated + * direct dispatch as well. * * XXX This pacing is really lame. It needs to be solved * by other methods. This is OK only because the worst @@ -833,7 +830,7 @@ g_io_schedule_down(struct thread *tp __unused) */ CTR0(KTR_GEOM, "g_down pacing self"); pause_count++; /* g_down has only one thread */ - pause("g_down", min(hz/1000, 1)); + pause_sbt("g_down", SBT_1MS, 0, 0); pace = 0; } CTR2(KTR_GEOM, "g_down processing bp %p provider %s", bp,