From 5af79eea27a55d14d96aee029195dd34f9cfb6e7 Mon Sep 17 00:00:00 2001 From: mjg Date: Sat, 30 Nov 2019 16:40:16 +0000 Subject: [PATCH] vfs: swap placement between v_type and v_tag The former is frequently accessed (e.g., in vfs_cache_lookup) and shares the cacheline with v_usecount, avoidably adding to cache misses during concurrent lookup. The latter is almost unused and probably can get garbage-collected. The struct does not change in size despite enum vs char * discrepancy. On 64-bit archs there used to be 4 bytes padding after v_type giving 480 bytes in total. --- sys/sys/vnode.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 27dbcbc58b18..b9a8d5458a0c 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -103,7 +103,7 @@ struct vnode { * Fields which define the identity of the vnode. These fields are * owned by the filesystem (XXX: and vgone() ?) */ - const char *v_tag; /* u type of underlying data */ + enum vtype v_type; /* u vnode type */ struct vop_vector *v_op; /* u vnode operations vector */ void *v_data; /* u private data for fs */ @@ -173,7 +173,7 @@ struct vnode { int v_writecount; /* I ref count of writers or (negative) text users */ u_int v_hash; - enum vtype v_type; /* u vnode type */ + const char *v_tag; /* u type of underlying data */ }; #endif /* defined(_KERNEL) || defined(_KVM_VNODE) */