diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2024-02-01 12:28:41 +0100 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-03-13 23:38:13 +0100 |
commit | 0225bdfafd818f895fa4a4512f124a1614e011e2 (patch) | |
tree | bdc0b79b1d1731cd67e41f430b89833d2dd44bad /mm | |
parent | bcachefs: bch2_lookup() gives better error message on inode not found (diff) | |
download | linux-0225bdfafd818f895fa4a4512f124a1614e011e2.tar.xz linux-0225bdfafd818f895fa4a4512f124a1614e011e2.zip |
mempool: kvmalloc pool
Add mempool_init_kvmalloc_pool() and mempool_create_kvmalloc_pool(),
which wrap kvmalloc() instead of kmalloc() - kmalloc() with a vmalloc()
fallback.
This is part of a bcachefs cleanup - dropping an internal kvpmalloc()
helper (which predates kvmalloc()) along with mempool helpers; this
replaces the bcachefs-private kvpmalloc_pool.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Cc: linux-mm@kvack.org
Diffstat (limited to 'mm')
-rw-r--r-- | mm/mempool.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/mm/mempool.c b/mm/mempool.c index dbbf0e9fb424..076c736f5f1f 100644 --- a/mm/mempool.c +++ b/mm/mempool.c @@ -590,6 +590,19 @@ void mempool_kfree(void *element, void *pool_data) } EXPORT_SYMBOL(mempool_kfree); +void *mempool_kvmalloc(gfp_t gfp_mask, void *pool_data) +{ + size_t size = (size_t)pool_data; + return kvmalloc(size, gfp_mask); +} +EXPORT_SYMBOL(mempool_kvmalloc); + +void mempool_kvfree(void *element, void *pool_data) +{ + kvfree(element); +} +EXPORT_SYMBOL(mempool_kvfree); + /* * A simple mempool-backed page allocator that allocates pages * of the order specified by pool_data. |