From nobody Mon Oct 06 22:31:37 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 4cgYsj1WPSz6BhpM for ; Mon, 06 Oct 2025 22:31:53 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cgYsh4Rtxz3gtR for ; Mon, 06 Oct 2025 22:31:52 +0000 (UTC) (envelope-from mjguzik@gmail.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20230601 header.b=QmdkEQGx; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mjguzik@gmail.com designates 2a00:1450:4864:20::631 as permitted sender) smtp.mailfrom=mjguzik@gmail.com Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-b456d2dc440so874733366b.0 for ; Mon, 06 Oct 2025 15:31:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1759789910; x=1760394710; darn=freebsd.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=qVQzZOpWC9C3KNoZycIyaPHaIcN9bixgRAkeepdzoww=; b=QmdkEQGx2v1dBksbSZV2DJCacrjO38dmwNTf6dFy8wn3m6FnBwLdrgA24zUQ+/llaW fo2XCBA7dmYjnoaQkeOOBzf+1Vo/tHC241iuQyY4YHG2wfeDnjYfRRrKOwk7sup0q9G8 peVpbOSnbiq0RNLpvKhTYmlX1YbrY8rfWFqsdtqtjtqvnel6OS/QKdw7PQYCH2SVx9n3 G5OyFu9vySzcNcuMGAEhYHNeHQV6j+dieR1J8XxkByEBP4a8D8JMPoNYdPTJhoClZKhj FCgpFZ9dMeDEc890RAePwjemQ2hNMdIeDjQJHCeh/TU0EaOqiWck2F5dnyKgicMA7PPW SK7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759789910; x=1760394710; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qVQzZOpWC9C3KNoZycIyaPHaIcN9bixgRAkeepdzoww=; b=SJ/8HByPaPu25qk/QIywrBFh6gfHsskE5OqD+/2arluhew9+nqJvj02EMcbimaQaE6 TTAREmqtlR1oK4WgHL/1nayTh7SWbKbcFsvgirDgED8HOZWqWDuXURbc6AK2+C8j4r/5 H/3CX7uxhBgNnxErFxuJVwFv7B25L/x55Mp/mo1MxM1xvnVzLF/HZQPUzHC6YyhgWsMU CkmvujNJY5OvQcDkuO0+Kp11wpH7eURhJmkPmkq96pt9tSAapK+e+VvDJqxweaGZk01x cv6AYmYsxqPq7XIwedcue2HiEYXFJooF2rIGXs4Us7HFUS2+bpbAvOGRXmjWKuAaN1GU iPXg== X-Forwarded-Encrypted: i=1; AJvYcCWVzCfCnOh3ImV/bK0ydHKbFyyQ9ZWE6M2pEqjZwICaePxQMdUPrkfLlRfoQRGTSiJ5L1GuN1u+rsYuXKVB1nvt57pUmg==@freebsd.org X-Gm-Message-State: AOJu0YxzSwpa6HxBx8uyQx4Tca9fcx/pA0Lfqq10xcQfbqz6pp+xhzp7 Wfucf3I7Hw+hNeVH7rLn4qiiN7ZpFNMW5x04En7BLdXBgw7GGamIfEZDgF92sdjusvy9mIMj3YV 3v43UsT9psra1z/NOxchDboRV1rZsYO8= X-Gm-Gg: ASbGncvnqz30129quA1jJbQvHx7LoW9cU0mqBCmHcgAlDRGsdFwLlEFo4rIO0lvrwrq xjZ4BsaBLaIyNcGALT8K6DznDhPru8vg4Pj8DN0gGnUSzYDIy6ysF60dZc+5yzSdKxAIXxAHWwl taoQcgBUIAyDWwYoGSXIB+QGY2eLMCckXlZt3iEHWmZfMtY/QhF85QdoPf5Tj/FEaTuJB5SVadw zRofbVx7X4bY97QLBQMskNO3l8hZDbHrg2D8NbVjzEiJxDS31pdiO6P4M/MiWk= X-Google-Smtp-Source: AGHT+IFAjzYwDXxqjdDHrkR5N0faIyT3IHxYoJu5LZaKcdFGbVG73RcCsr8ym+65nAvGqvHJhY3IkhQBll+SYDaGLfI= X-Received: by 2002:a17:906:c102:b0:b0d:416e:2892 with SMTP id a640c23a62f3a-b49c3932c40mr1826880766b.32.1759789909492; Mon, 06 Oct 2025 15:31:49 -0700 (PDT) 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 References: <202510061823.596IN7oZ084715@gitrepo.freebsd.org> In-Reply-To: From: Mateusz Guzik Date: Tue, 7 Oct 2025 00:31:37 +0200 X-Gm-Features: AS18NWA88MmsniLXuCRKRWw8VtVhD4fUjKSLSxvuBX61P6jOk9DRxqZw1SZIFCk Message-ID: Subject: Re: git: 84f981ba57e7 - main - nullfs: shrink null_node to 32 bytes To: Konstantin Belousov Cc: Mateusz Guzik , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spamd-Bar: --- X-Spamd-Result: default: False [-4.00 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-0.998]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36:c]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20230601]; MIME_GOOD(-0.10)[text/plain]; ARC_NA(0.00)[]; FREEMAIL_TO(0.00)[gmail.com]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::631:from]; RCVD_TLS_LAST(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; FREEMAIL_FROM(0.00)[gmail.com]; FROM_HAS_DN(0.00)[]; MISSING_XM_UA(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-main@freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; MID_RHS_MATCH_FROMTLD(0.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; MLMMJ_DEST(0.00)[dev-commits-src-main@freebsd.org]; RCVD_COUNT_ONE(0.00)[1]; FREEMAIL_ENVFROM(0.00)[gmail.com] X-Rspamd-Queue-Id: 4cgYsh4Rtxz3gtR On Tue, Oct 7, 2025 at 12:30=E2=80=AFAM Mateusz Guzik w= rote: > > On Tue, Oct 7, 2025 at 12:25=E2=80=AFAM Konstantin Belousov wrote: > > > > 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=3D84f981ba57e77bd3c3d0fb= f1469ce51bfd132a6b > > > > > > 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_hashtb= l; > > > +static CK_SLIST_HEAD(null_node_hashhead, null_node) *null_node_hasht= bl; > > > static struct rwlock null_hash_lock; > > > static u_long null_hash_mask; > > > > > > @@ -116,7 +116,7 @@ null_hashget_locked(struct mount *mp, struct vnod= e *lowervp) > > > * reference count (but NOT the lower vnode's VREF counter). > > > */ > > > hd =3D NULL_NHASH(lowervp); > > > - CK_LIST_FOREACH(a, hd, null_hash) { > > > + CK_SLIST_FOREACH(a, hd, null_hash) { > > > if (a->null_lowervp !=3D lowervp) > > > continue; > > > /* > > > @@ -148,7 +148,7 @@ null_hashget(struct mount *mp, struct vnode *lowe= rvp) > > > > > > vfs_smr_enter(); > > > hd =3D NULL_NHASH(lowervp); > > > - CK_LIST_FOREACH(a, hd, null_hash) { > > > + CK_SLIST_FOREACH(a, hd, null_hash) { > > > if (a->null_lowervp !=3D 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 *low= ervp, struct vnode **vpp) > > > void > > > null_hashrem(struct null_node *xp) > > > { > > > + struct null_node_hashhead *hd; > > > > > > + hd =3D 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? > > > > For the hash to be at all useful the chains are supposed to be short. > > Or to put it differently, a sensibly sized hash with a sensible > hashing function makes it automatically fine. > > This was worthwhile to do because the original size of 40 bytes is a > very poor fit for the allocator. > > fwiw the namecache already works this way for few years. > > the regular vnode hash should probably get the same treatment, saving > 8 bytes off of struct vnode I can concede it would make sense to include this in the commit message.