Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 09 Jan 2026 14:16:18 +0000
From:      Brooks Davis <brooks@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 258ad800929b - main - cache: avoid hardcoded cache padding
Message-ID:  <69610db2.d401.3562f539@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by brooks:

URL: https://cgit.FreeBSD.org/src/commit/?id=258ad800929b397c79bd1fc8178e14bfec9ebe78

commit 258ad800929b397c79bd1fc8178e14bfec9ebe78
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2026-01-09 14:15:35 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2026-01-09 14:15:35 +0000

    cache: avoid hardcoded cache padding
    
    Replace CACHE_LARGE_PAD with rounding up to the alignment of struct
    namecache_ts.
    
    No functional change.
    
    Reviewed by:    olce, markj
    Suggested by:   jhb
    Effort:         CHERI upstreaming
    Sponsored by:   DARPA, AFRL
    Differential Revision:  https://reviews.freebsd.org/D54553
---
 sys/kern/vfs_cache.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c
index c5abc1c8b9b7..404234861710 100644
--- a/sys/kern/vfs_cache.c
+++ b/sys/kern/vfs_cache.c
@@ -420,10 +420,8 @@ TAILQ_HEAD(cache_freebatch, namecache);
  */
 #ifdef __LP64__
 #define	CACHE_PATH_CUTOFF	45
-#define	CACHE_LARGE_PAD		6
 #else
 #define	CACHE_PATH_CUTOFF	41
-#define	CACHE_LARGE_PAD		2
 #endif
 
 #define CACHE_ZONE_SMALL_SIZE						\
@@ -431,7 +429,8 @@ TAILQ_HEAD(cache_freebatch, namecache);
 #define CACHE_ZONE_SMALL_TS_SIZE					\
     (offsetof(struct namecache_ts, nc_nc) + CACHE_ZONE_SMALL_SIZE)
 #define CACHE_ZONE_LARGE_SIZE						\
-    (offsetof(struct namecache, nc_name) + NAME_MAX + 1 + CACHE_LARGE_PAD)
+    roundup2(offsetof(struct namecache, nc_name) + NAME_MAX + 1,	\
+    _Alignof(struct namecache_ts))
 #define CACHE_ZONE_LARGE_TS_SIZE					\
     (offsetof(struct namecache_ts, nc_nc) + CACHE_ZONE_LARGE_SIZE)
 


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69610db2.d401.3562f539>