From nobody Wed Nov 01 08:40:39 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 4SL0p050fyz501KK; Wed, 1 Nov 2023 08:40:40 +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 4SL0p011djz3Gtr; Wed, 1 Nov 2023 08:40:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1698828040; 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=3/z9SgEwVlj/Jk8KhT8+Npz+sNkV7wDykusZ597QU4Y=; b=thSvisxpf3au9lM3Z3ZYZnEG2/sgDkeMIdhbSV4X4UIn4tIR6jw5JMD01KkLD9Lnigfa1x 1c54gw1Z1SU/ZmkXkKBpoIPZh4l8/l0VINVUbt+7Z2z2w2VpinRtgtoUEqBNj+5+8apRJF hICUUwVqr+8wavoWfXdfxRYuZVLCSbcHqznqMlNed3A09ytN4j4URqDRYa7rjsy+65FeAV 7y9CHPtyDxBn4ujUnVAsFiB9WvIuR3rykZdVgESTH3kqhR38z00CU5w2fpKFEZrdDZICYV LAFKNROklmyvld1L+XUlfGLgQI20hL2AObKDQnbIZ26pmfE2JvT1e4Vp5qLADg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1698828040; 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=3/z9SgEwVlj/Jk8KhT8+Npz+sNkV7wDykusZ597QU4Y=; b=kEd172FenoFj5GBHWLyJWSn9wcKX0OYvIMp0DNkveVFTv39UjsKiboWDF67UBWIe6Tf26q j2/OHWBnma6v0jp5FuSci1R66yc3kSciFRCXpy52KR18clzl253SYCbpOlB3L/uC2LCTaU uDtGvekq5uZcMWNNBdrlKTAP5GxXS/bWL5ZVqnH6/G5MK7Js6ZjvG9L45svgIR/O1YTAFI ttTQU5Q8Ni36mkXvllSRN+SoL6ZD+3kWDSjtSdiNaZXoTuiFIV3GOOvYEmbRAW5ejAdII7 SEq4zELY00rqhgENnawfay6wLvdUhk7F0m+ul1Qby49Gjq/1Xo1MTls4pLh5TQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1698828040; a=rsa-sha256; cv=none; b=LzV/b0ewGxi0EFpDbly6zhpz7r9tNa9BVLiYqvMp5Jdzt2IVEmELreG9SSkqCdSlcIIWvv YsB/xwH3Tcm+bq8f2iWWKLouGBiIbzhqBtN/d+MpFwqWYtRtkRYG/bAm4hT45NaQ58+3Qr xiWYKh1YQRU/Y3qcmOlwfvZExhxtbvhIP0tkFsB92GWCoINuZAmY446oXUyIhYPn/08xRa hHfg26JE4MCWWqBlLTLCOdJmJfct0wX5VsusHQvU46yD60Mb2RvqUySVvfswYDZJh4M01m iz2lJim1qgHW2PZnzYXpBPu4BohYqSaEzKkyy6S27cQqIAuPmnLqwJQrwD46Cg== 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 4SL0p000mwzg71; Wed, 1 Nov 2023 08:40:40 +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 3A18edb5023653; Wed, 1 Nov 2023 08:40:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3A18ed2m023650; Wed, 1 Nov 2023 08:40:39 GMT (envelope-from git) Date: Wed, 1 Nov 2023 08:40:39 GMT Message-Id: <202311010840.3A18ed2m023650@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: 0c5cd045bfb8 - main - vfs: remove majority of stale commentary about free list 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: 0c5cd045bfb847428a8a5e0e91e6fc3cf27a17c2 Auto-Submitted: auto-generated The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=0c5cd045bfb847428a8a5e0e91e6fc3cf27a17c2 commit 0c5cd045bfb847428a8a5e0e91e6fc3cf27a17c2 Author: Mateusz Guzik AuthorDate: 2023-11-01 08:28:28 +0000 Commit: Mateusz Guzik CommitDate: 2023-11-01 08:39:05 +0000 vfs: remove majority of stale commentary about free list There is no "free list" for a long time now. While here slightly tidy up affected comments in other ways. Note that the "free vnode" term is a misnomer at best and will also need to get sorted out. --- sys/kern/vfs_subr.c | 47 +++++++++++++++++------------------------------ 1 file changed, 17 insertions(+), 30 deletions(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 881e9452a6db..b12b257ce340 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1224,7 +1224,7 @@ restart: * If it's been deconstructed already, it's still * referenced, or it exceeds the trigger, skip it. * Also skip free vnodes. We are trying to make space - * to expand the free list, not reduce it. + * for more free vnodes, not reduce their count. */ if (vp->v_usecount > 0 || vp->v_holdcnt == 0 || (!reclaim_nc_src && !LIST_EMPTY(&vp->v_cache_src))) @@ -1319,7 +1319,7 @@ SYSCTL_INT(_vfs_vnode_vnlru, OID_AUTO, max_free_per_call, CTLFLAG_RW, "limit on vnode free requests per call to the vnlru_free routine"); /* - * Attempt to reduce the free list by the requested amount. + * Attempt to recycle requested amount of free vnodes. */ static int vnlru_free_impl(int count, struct vfsops *mnt_op, struct vnode *mvp, bool isvnlru) @@ -1761,7 +1761,7 @@ vnlru_proc(void) /* * If numvnodes is too large (due to desiredvnodes being * adjusted using its sysctl, or emergency growth), first - * try to reduce it by discarding from the free list. + * try to reduce it by discarding free vnodes. */ if (rnumvnodes > desiredvnodes + 10) { vnlru_free_locked_vnlru(rnumvnodes - desiredvnodes); @@ -1772,7 +1772,7 @@ vnlru_proc(void) * Sleep if the vnode cache is in a good state. This is * when it is not over-full and has space for about a 4% * or 9% expansion (by growing its size or inexcessively - * reducing its free list). Otherwise, try to reclaim + * reducing free vnode count). Otherwise, try to reclaim * space for a 10% expansion. */ if (vstir && force == 0) { @@ -1858,10 +1858,7 @@ SYSINIT(vnlru, SI_SUB_KTHREAD_UPDATE, SI_ORDER_FIRST, kproc_start, */ /* - * Try to recycle a freed vnode. We abort if anyone picks up a reference - * before we actually vgone(). This function must be called with the vnode - * held to prevent the vnode from being returned to the free list midway - * through vgone(). + * Try to recycle a freed vnode. */ static int vtryrecycle(struct vnode *vp, bool isvnlru) @@ -1976,14 +1973,10 @@ vn_alloc_hard(struct mount *mp, u_long rnumvnodes, bool bumped) } /* - * Grow the vnode cache if it will not be above its target max - * after growing. Otherwise, if the free list is nonempty, try - * to reclaim 1 item from it before growing the cache (possibly - * above its target max if the reclamation failed or is delayed). - * Otherwise, wait for some space. In all cases, schedule - * vnlru_proc() if we are getting short of space. The watermarks - * should be chosen so that we never wait or even reclaim from - * the free list to below its target minimum. + * Grow the vnode cache if it will not be above its target max after + * growing. Otherwise, if there is at least one free vnode, try to + * reclaim 1 item from it before growing the cache (possibly above its + * target max if the reclamation failed or is delayed). */ if (vnlru_free_locked_direct(1) > 0) goto alloc; @@ -2038,7 +2031,7 @@ vn_free(struct vnode *vp) } /* - * Return the next vnode from the free list. + * Allocate a new vnode. */ int getnewvnode(const char *tag, struct mount *mp, struct vop_vector *vops, @@ -3221,16 +3214,10 @@ v_init_counters(struct vnode *vp) } /* - * Grab a particular vnode from the free list, increment its - * reference count and lock it. VIRF_DOOMED is set if the vnode - * is being destroyed. Only callers who specify LK_RETRY will - * see doomed vnodes. If inactive processing was delayed in - * vput try to do it here. - * - * usecount is manipulated using atomics without holding any locks. + * Get a usecount on a vnode. * - * holdcnt can be manipulated using atomics without holding any locks, - * except when transitioning 1<->0, in which case the interlock is held. + * vget and vget_finish may fail to lock the vnode if they lose a race against + * it being doomed. LK_RETRY can be passed in flags to lock it anyway. * * Consumers which don't guarantee liveness of the vnode can use SMR to * try to get a reference. Note this operation can fail since the vnode @@ -3882,9 +3869,9 @@ vdbatch_dequeue(struct vnode *vp) } /* - * Drop the hold count of the vnode. If this is the last reference to - * the vnode we place it on the free list unless it has been vgone'd - * (marked VIRF_DOOMED) in which case we will free it. + * Drop the hold count of the vnode. + * + * It will only get freed if this is the last hold *and* it has been vgone'd. * * Because the vnode vm object keeps a hold reference on the vnode if * there is at least one resident non-cached page, the vnode cannot @@ -4200,7 +4187,7 @@ loop: } /* - * Recycle an unused vnode to the front of the free list. + * Recycle an unused vnode. */ int vrecycle(struct vnode *vp)