Re: [PATCH] mm/vmalloc: avoid false sharing with drain_vmap_work

From: JonasZhou-oc

Date: Thu Nov 26 2026 - 21:31:30 EST


> Should the test be performed again on latest RC kernel ?

Yes. I retested on v7.4-rc4 (b6a9fa34ce41) on the same dual-socket
Xeon Silver 4208. In the unpatched x86-64 builds I tested, GCC placed
the two variables next to each other, with 32-byte alignment for
drain_vmap_work and 8-byte alignment for the vmap_nodes pointer.
Whether they share a 64-byte cache line depends on the kernel config.
After I set CONFIG_RSEQ=n, drain_vmap_work and vmap_nodes shared the
same cache line.

With 16 workers, SMT off and the CPUs fixed at 2.0 GHz, the mean
worker times over 10 runs were:

test unpatched patched reduction
fix_align_alloc_test 6.129 s 5.365 s 12.47%
fix_size_alloc_test 4.836 s 3.850 s 20.39%
no_block_alloc_test 4.840 s 3.882 s 19.79%

> s/away/cacheline away/ instead ?

Agreed. I'd make the cache-line separation and the reason for it
explicit in the comment:

/*
* Keep drain_vmap_work and vmap_nodes on separate cache lines.
* CPUs queuing the work write its pending bit, while CPUs allocating
* or freeing vmap areas read vmap_nodes.
*/