Matthew Wilcox 于2024年11月4日周一 21:27写道: > On Mon, Nov 04, 2024 at 02:16:17PM +0800, Ke Sun wrote: > > Use the KMEM_CACHE() macro instead of kmem_cache_create() to simplify > > the creation of SLAB caches. > > Did you even test this? It is REQUIRED that maple_node be aligned to > I have tests on an ARM64 QEMU VM and enabled some Maple Tree debugging configs: CONFIG_DEBUG_VM_MAPLE_TREE=y CONFIG_DEBUG_MAPLE_TREE=y CONFIG_TEST_MAPLE_TREE=y The results show: [ 1.434017][ T1] TEST STARTING [ 1.434017][ T1] [ 78.257756][ T1] maple_tree: 172860522 of 172860522 tests passed [ 78.271770][ T1] atomic64_test: passed > its size (eg 256 bytes) as the bottom bits of pointers to nodes are used > for other purposes. KMEM_CACHE() does not give us this guarantee. > The code comments of kmem_cache say: 'The alignment of the struct determines object alignment.' #define KMEM_CACHE(__struct, __flags) \ __kmem_cache_create_args(#__struct, sizeof(struct __struct), \ &(struct kmem_cache_args) { \ .align = __alignof__(struct __struct), \ }, (__flags)) > > NACK. > >