From nobody Fri Aug 02 02:38:14 2024 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 4WZqkt571bz5S0Ns; Fri, 02 Aug 2024 02:38:14 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WZqkt3Cdsz47Wm; Fri, 2 Aug 2024 02:38:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722566294; 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=JwfG/uQ15jqCzNU9ogikf/MJ4ptde0oavklbwvImqrU=; b=xPyg3jowbSqPeOuMZEn/QRdK3zD9Z7QfdCpNfUQc9ibTAQ2GCBE7JJe8rNz2hGTO0DyUD1 fmF2WvUPFqK1uQCkhJ6MBR1r+5jj+xTe++bSkkQtxfSxM6KyGfbK/TpfxiHnAkYvh4ziet AJTN6ec/jlE4gv50LS//NU+c3gx3y7kBnPDg1eBdt+Otw0oKiE/WC+6xXmuZTEm1XwYtcD p4h/P8MuAGp8W9aNNDJjY6sap81zpaegW0Romkv4pn171zBxbq+3mzytTz5JG65r5ZBfwW kzsB53xTA1Gi6t/AD3xgS4Bx203lChZJxNCBmwUbgSrsEbwfnuLIXO78pn/CbQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722566294; a=rsa-sha256; cv=none; b=VXR+dS4YNv5RdyDCiUrN4JdW0tvRbN0rsNMYAkfnH87YkXzcX/dK6ERcmOKiu2OEYNu/W9 19CY4ORdaTGq3EruXOG6nsJNVCyan1mwgnG/khV54pBUBGbQLdoOi2zYe7zbWa2bcpjmpq BIoVm+qrljIuolaTUJhoF1uzmruaqtVtusOMy0owUaJQ2yS7oSsJMeWmYJ7fVntRelLx3u SU/FQVzbeczFQ6uc8OYj4LH9Xa2LRf4Yc5cfX66u64Q9TT5xjY1OR6WsdU0rqoT1IiErmP oZOBoxEndBw+Tul7kdz2UnKhrEG29b7MAQCE5sL8lzOh0D+MuBNERbbIMFZlbg== 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=1722566294; 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=JwfG/uQ15jqCzNU9ogikf/MJ4ptde0oavklbwvImqrU=; b=TFjXtB+53I+lWNSNO34ftEydagCdkEjLI2i9gYYcu6T1FpfBk/WIT3XBsO7U45qBMZSdco Eb8CMck92Xekzj8cGak1d49mx3qeRWw3ERaD7US7ki+4mNU7hFSLY3tYad1VZ6RVmXbcH1 fBmjK0E1UzChNGDnK+PzvACqtc7A18vETYSTClNjftjVnZlaNHY18aPk/ELfpSWrYR5MT7 NU6niXjgEI15PI6Wh2uPBrRbuQG1eDGFQpmnJI7xJbKsSECGxOxQLb8hgS30B0pbK/K5R5 scGpeTNbS3dBU4f0szMo7PtzWzTf4DLMBfqs6RPfwFXCK7WtKQL76iXN18AXxg== 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 4WZqkt2htBz18xL; Fri, 2 Aug 2024 02:38:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4722cEke051400; Fri, 2 Aug 2024 02:38:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4722cEf3051397; Fri, 2 Aug 2024 02:38:14 GMT (envelope-from git) Date: Fri, 2 Aug 2024 02:38:14 GMT Message-Id: <202408020238.4722cEf3051397@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Doug Moore Subject: git: 6d86bdf1c423 - main - vm_pageout: shrink pageout array 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dougm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6d86bdf1c423e162cecd9b7c516b211461d1932b Auto-Submitted: auto-generated The branch main has been updated by dougm: URL: https://cgit.FreeBSD.org/src/commit/?id=6d86bdf1c423e162cecd9b7c516b211461d1932b commit 6d86bdf1c423e162cecd9b7c516b211461d1932b Author: Doug Moore AuthorDate: 2024-08-02 02:36:44 +0000 Commit: Doug Moore CommitDate: 2024-08-02 02:36:44 +0000 vm_pageout: shrink pageout array The array passed to vm_pageout_flush, and constructed in a middle-out fashion, can never use array element zero. Shrink the array by one, and reduce indices by one, to save that bit of stack space. In the vm_object version, make the accounting look more like the pageout version. Reported by: alc Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D46208 --- sys/vm/vm_object.c | 17 +++++++++-------- sys/vm/vm_pageout.c | 6 +++--- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index be21081255c2..7b3950b6f3bc 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -1115,13 +1115,14 @@ static int vm_object_page_collect_flush(vm_object_t object, vm_page_t p, int pagerflags, int flags, boolean_t *allclean, boolean_t *eio) { - vm_page_t ma[2 * vm_pageout_page_count], tp; - int count, mreq, runlen; + vm_page_t ma[2 * vm_pageout_page_count - 1], tp; + int base, count, runlen; vm_page_lock_assert(p, MA_NOTOWNED); vm_page_assert_xbusied(p); VM_OBJECT_ASSERT_WLOCKED(object); - ma[vm_pageout_page_count] = p; + base = nitems(ma) / 2; + ma[base] = p; for (count = 1, tp = p; count < vm_pageout_page_count; count++) { tp = vm_page_next(tp); if (tp == NULL || vm_page_tryxbusy(tp) == 0) @@ -1130,10 +1131,10 @@ vm_object_page_collect_flush(vm_object_t object, vm_page_t p, int pagerflags, vm_page_xunbusy(tp); break; } - ma[vm_pageout_page_count + count] = tp; + ma[base + count] = tp; } - for (mreq = 0, tp = p; count < vm_pageout_page_count; count++, mreq++) { + for (tp = p; count < vm_pageout_page_count; count++) { tp = vm_page_prev(tp); if (tp == NULL || vm_page_tryxbusy(tp) == 0) break; @@ -1141,11 +1142,11 @@ vm_object_page_collect_flush(vm_object_t object, vm_page_t p, int pagerflags, vm_page_xunbusy(tp); break; } - ma[vm_pageout_page_count - 1 - mreq] = tp; + ma[--base] = tp; } - vm_pageout_flush(&ma[vm_pageout_page_count - mreq], count, pagerflags, - mreq, &runlen, eio); + vm_pageout_flush(&ma[base], count, pagerflags, nitems(ma) / 2 - base, + &runlen, eio); return (runlen); } diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c index e848d68739ca..8ad4bf4d3ab4 100644 --- a/sys/vm/vm_pageout.c +++ b/sys/vm/vm_pageout.c @@ -348,7 +348,7 @@ static int vm_pageout_cluster(vm_page_t m) { vm_object_t object; - vm_page_t mc[2 * vm_pageout_page_count], p, pb, ps; + vm_page_t mc[2 * vm_pageout_page_count - 1], p, pb, ps; vm_pindex_t pindex; int ib, is, page_base, pageout_count; @@ -358,9 +358,9 @@ vm_pageout_cluster(vm_page_t m) vm_page_assert_xbusied(m); - mc[vm_pageout_page_count] = pb = ps = m; pageout_count = 1; - page_base = vm_pageout_page_count; + page_base = nitems(mc) / 2; + mc[page_base] = pb = ps = m; ib = 1; is = 1;