From nobody Mon Oct 6 22:25:01 2025 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 4cgYk370tgz6BhP6; Mon, 06 Oct 2025 22:25:15 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4cgYk33qkdz3ftr; Mon, 06 Oct 2025 22:25:15 +0000 (UTC) (envelope-from kostikbel@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: from tom.home (kib@localhost [127.0.0.1] (may be forged)) by kib.kiev.ua (8.18.1/8.18.1) with ESMTP id 596MP1Y3081336; Tue, 7 Oct 2025 01:25:04 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 596MP1Y3081336 Received: (from kostik@localhost) by tom.home (8.18.1/8.18.1/Submit) id 596MP1Tm081335; Tue, 7 Oct 2025 01:25:01 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 7 Oct 2025 01:25:01 +0300 From: Konstantin Belousov To: Mateusz Guzik Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 84f981ba57e7 - main - nullfs: shrink null_node to 32 bytes Message-ID: References: <202510061823.596IN7oZ084715@gitrepo.freebsd.org> 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=us-ascii Content-Disposition: inline In-Reply-To: <202510061823.596IN7oZ084715@gitrepo.freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on tom.home X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Queue-Id: 4cgYk33qkdz3ftr On Mon, Oct 06, 2025 at 06:23:07PM +0000, Mateusz Guzik wrote: > The branch main has been updated by mjg: > > URL: https://cgit.FreeBSD.org/src/commit/?id=84f981ba57e77bd3c3d0fbf1469ce51bfd132a6b > > commit 84f981ba57e77bd3c3d0fbf1469ce51bfd132a6b > Author: Mateusz Guzik > AuthorDate: 2025-10-06 17:59:17 +0000 > Commit: Mateusz Guzik > CommitDate: 2025-10-06 18:23:01 +0000 > > nullfs: shrink null_node to 32 bytes > --- > sys/fs/nullfs/null.h | 2 +- > sys/fs/nullfs/null_subr.c | 12 +++++++----- > 2 files changed, 8 insertions(+), 6 deletions(-) > > diff --git a/sys/fs/nullfs/null.h b/sys/fs/nullfs/null.h > index aa7a689bec34..ad3f7779e108 100644 > --- a/sys/fs/nullfs/null.h > +++ b/sys/fs/nullfs/null.h > @@ -53,7 +53,7 @@ struct null_mount { > * A cache of vnode references > */ > struct null_node { > - CK_LIST_ENTRY(null_node) null_hash; /* Hash list */ > + CK_SLIST_ENTRY(null_node) null_hash; /* Hash list */ > struct vnode *null_lowervp; /* VREFed once */ > struct vnode *null_vnode; /* Back pointer */ > u_int null_flags; > diff --git a/sys/fs/nullfs/null_subr.c b/sys/fs/nullfs/null_subr.c > index ad8cd08279cc..bb0ff9966dfd 100644 > --- a/sys/fs/nullfs/null_subr.c > +++ b/sys/fs/nullfs/null_subr.c > @@ -59,7 +59,7 @@ VFS_SMR_DECLARE; > > #define NULL_NHASH(vp) (&null_node_hashtbl[vfs_hash_index(vp) & null_hash_mask]) > > -static CK_LIST_HEAD(null_node_hashhead, null_node) *null_node_hashtbl; > +static CK_SLIST_HEAD(null_node_hashhead, null_node) *null_node_hashtbl; > static struct rwlock null_hash_lock; > static u_long null_hash_mask; > > @@ -116,7 +116,7 @@ null_hashget_locked(struct mount *mp, struct vnode *lowervp) > * reference count (but NOT the lower vnode's VREF counter). > */ > hd = NULL_NHASH(lowervp); > - CK_LIST_FOREACH(a, hd, null_hash) { > + CK_SLIST_FOREACH(a, hd, null_hash) { > if (a->null_lowervp != lowervp) > continue; > /* > @@ -148,7 +148,7 @@ null_hashget(struct mount *mp, struct vnode *lowervp) > > vfs_smr_enter(); > hd = NULL_NHASH(lowervp); > - CK_LIST_FOREACH(a, hd, null_hash) { > + CK_SLIST_FOREACH(a, hd, null_hash) { > if (a->null_lowervp != lowervp) > continue; > /* > @@ -189,7 +189,7 @@ null_hashins(struct mount *mp, struct null_node *xp) > } > } > #endif > - CK_LIST_INSERT_HEAD(hd, xp, null_hash); > + CK_SLIST_INSERT_HEAD(hd, xp, null_hash); > } > > static void > @@ -305,9 +305,11 @@ null_nodeget(struct mount *mp, struct vnode *lowervp, struct vnode **vpp) > void > null_hashrem(struct null_node *xp) > { > + struct null_node_hashhead *hd; > > + hd = NULL_NHASH(xp->null_lowervp); > rw_wlock(&null_hash_lock); > - CK_LIST_REMOVE(xp, null_hash); > + CK_SLIST_REMOVE(hd, xp, null_node, null_hash); This changes O(1) removal into O(N), for N being the size of the hash chain length for specific hash. I.e. it is on par with the lookup. Why it is fine? Why it was not mentioned and explained in the commit message? > rw_wunlock(&null_hash_lock); > } >