]> 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>
Tue, 12 Nov 2024 16:25:36 +0000 (17:25 +0100)
commitf21b728d3e82a076101a0cdd653b11f848d32930
treee68027b1f0850abda2d5e8bec781d7156b26da34
parentc9f40620a790e13720a1e4ba55a1a74925306338
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