From nobody Sat Sep 16 15:54:37 2023 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 4Rnwbx5sv6z4tYL1; Sat, 16 Sep 2023 15:54:37 +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 4Rnwbx5KsPz4gq2; Sat, 16 Sep 2023 15:54:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694879677; 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=ZnzTvxriQ9fsiYoSPj1oEyiZh4iYiYF0nhTIYQitzEM=; b=ZWp92y2LCaj/j62N4H2e8TN1KtgW5mC9fibqn+zsXKxfaAoZoqtWtPT7VAZW0z+XIgeTzN jNiFwu/IrSvaJSoz+nExqOS2erxvVtNgpcybu3HcpsZ0gn1swf1cRrxQm1fmo9KxI+h+ju CZFLBg/H0TVv1h/QFGH8rnXY76Gq3ePVloqWvjeWvsYT2oVavoYlIo1VImpKWoUwTvaz4p cPLamP/CzKFPpAo5OUcPzALHcHPbtqM59PPNnrgGjeHJxrThVoTVOtC1o9eO8zdgGPYUKj zryq/eTP01Dp+R44oI8MZSOmSjJLzIiV1IzxerSxR4w0ZP7hHhS994MVhhoE9g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1694879677; a=rsa-sha256; cv=none; b=OVpo8C28mWAuExouecDQecRCfa0G6snoxzewlFKxSE3d3uRxfDuw4gAM1Q+81Z3abakvEj dkMBDpYv/NEpLiklsG0XamDvfrOpYU+e9CIJDvJJMl+uOor79f6s9LGrnMFbYO1lbIxa5A cmNOMoHh4X/zccLCujtN1GRwYSp8M9Vx9IhB/QHvHgBAgTAK4pjztgUEqvYSWDEddDYAuy +6E5T9koxDWYxEKV7397gCzxoAx1NR19k0CIsArKYwGrzz7dEo/k9EkXavVEta5vhkXgUb pWfEgPeqXI4hXsB9ujW52bUeQ8GcrBsOnANf3wZlklFoSVMKuKu7g/E5+F7SnQ== 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=1694879677; 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=ZnzTvxriQ9fsiYoSPj1oEyiZh4iYiYF0nhTIYQitzEM=; b=hWqFb5Vi9ygLIiR6/enByDdXafV6zpZ4+KFElcPLbdolQlL47H+Ma+pD0aqs4SWQA+OxCL zSak6ULc7Uwk6rWNAPZV6NAQmiObWbuCv1KLnLPVPZ82FVtQRSMoeoAyHHCMOMF32spz4V FKQFm1N24u3qbU78Hrsljl93qlP+S30kjxwfG7dMPA9J1PoQYkpEKHWVOcgzSUCHXRXvxS AnPOR6MAbq8qwU/3mv/jyjJ01F2rUUkMNnOzgC//a1YiIQTaAmir0gAqOGN1palFVAxaw0 cpPuWPUC3YgCB6lM9paO7/o9AS5iZceby49Dq7AXCfRaCPPHzQkTwSgVmXzH5A== 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 4Rnwbx4NyWz1C81; Sat, 16 Sep 2023 15:54:37 +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 38GFsbkb064476; Sat, 16 Sep 2023 15:54:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38GFsbP9064474; Sat, 16 Sep 2023 15:54:37 GMT (envelope-from git) Date: Sat, 16 Sep 2023 15:54:37 GMT Message-Id: <202309161554.38GFsbP9064474@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: ef89b78bb1f6 - main - vfs: stabilize freevnodes_old 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: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ef89b78bb1f60484cc743fa590d623ad896ca8e9 Auto-Submitted: auto-generated The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=ef89b78bb1f60484cc743fa590d623ad896ca8e9 commit ef89b78bb1f60484cc743fa590d623ad896ca8e9 Author: Mateusz Guzik AuthorDate: 2023-09-16 15:41:12 +0000 Commit: Mateusz Guzik CommitDate: 2023-09-16 15:54:09 +0000 vfs: stabilize freevnodes_old In face of parallel callers. --- sys/kern/vfs_subr.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 9d5b1b7e472e..11cdea5a7dc1 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1528,21 +1528,22 @@ vfs_freevnodes_dec(void) static u_long vnlru_read_freevnodes(void) { - long slop, rfreevnodes; + long slop, rfreevnodes, rfreevnodes_old; int cpu; rfreevnodes = atomic_load_long(&freevnodes); + rfreevnodes_old = atomic_load_long(&freevnodes_old); - if (rfreevnodes > freevnodes_old) - slop = rfreevnodes - freevnodes_old; + if (rfreevnodes > rfreevnodes_old) + slop = rfreevnodes - rfreevnodes_old; else - slop = freevnodes_old - rfreevnodes; + slop = rfreevnodes_old - rfreevnodes; if (slop < VNLRU_FREEVNODES_SLOP) return (rfreevnodes >= 0 ? rfreevnodes : 0); - freevnodes_old = rfreevnodes; CPU_FOREACH(cpu) { - freevnodes_old += cpuid_to_pcpu[cpu]->pc_vfs_freevnodes; + rfreevnodes += cpuid_to_pcpu[cpu]->pc_vfs_freevnodes; } + atomic_store_long(&freevnodes_old, rfreevnodes); return (freevnodes_old >= 0 ? freevnodes_old : 0); }