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.
This commit is contained in:
Mateusz Guzik 2019-11-30 16:40:16 +00:00
parent 23614c2b39
commit 89c4c2e53b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=355226

View File

@ -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) */