]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm, slub: sheaf prefilling for guaranteed allocations
authorVlastimil Babka <vbabka@suse.cz>
Tue, 5 Nov 2024 16:00:08 +0000 (17:00 +0100)
committerVlastimil Babka <vbabka@suse.cz>
Fri, 17 Jan 2025 18:33:39 +0000 (19:33 +0100)
commita6f626a3a655a3f773b17550e3990a4c72354c72
tree947b905cdbd1455f72ec8f70503bd0bab41d8848
parentcba930ce7af3e2f47f615f00a41aa4f1708f4845
mm, slub: sheaf prefilling for guaranteed allocations

Add three functions for efficient guaranteed allocations in a critical
section (that cannot sleep) when the exact number of allocations is not
known beforehand, but an upper limit can be calculated.

kmem_cache_prefill_sheaf() returns a sheaf containing at least given
number of objects.

kmem_cache_alloc_from_sheaf() will allocate an object from the sheaf
and is guaranteed not to fail until depleted.

kmem_cache_return_sheaf() is for giving the sheaf back to the slab
allocator after the critical section. This will also attempt to refill
it to cache's sheaf capacity for better efficiency of sheaves handling,
but it's not stricly necessary to succeed.

TODO: the current implementation is limited to cache's sheaf_capacity

Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
include/linux/slab.h
mm/slub.c