projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5626196
)
mempool: introduce mempool_is_saturated
author
Pavel Begunkov
<asml.silence@gmail.com>
Wed, 2 Nov 2022 15:18:19 +0000
(15:18 +0000)
committer
Jens Axboe
<axboe@kernel.dk>
Wed, 16 Nov 2022 16:44:26 +0000
(09:44 -0700)
Introduce a helper mempool_is_saturated(), which tells if the mempool is
under-filled or not. We need it to figure out whether it should be
freed right into the mempool or could be cached with top level caches.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link:
https://lore.kernel.org/r/636aed30be8c35d78f45e244998bc6209283cccc.1667384020.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
include/linux/mempool.h
patch
|
blob
|
history
diff --git
a/include/linux/mempool.h
b/include/linux/mempool.h
index 0c964ac107c2c443d7b68cf33bd9d90a9be1c23a..4aae6c06c5f283d4abbcf213b309f834af0f03e0 100644
(file)
--- a/
include/linux/mempool.h
+++ b/
include/linux/mempool.h
@@
-30,6
+30,11
@@
static inline bool mempool_initialized(mempool_t *pool)
return pool->elements != NULL;
}
+static inline bool mempool_is_saturated(mempool_t *pool)
+{
+ return READ_ONCE(pool->curr_nr) >= pool->min_nr;
+}
+
void mempool_exit(mempool_t *pool);
int mempool_init_node(mempool_t *pool, int min_nr, mempool_alloc_t *alloc_fn,
mempool_free_t *free_fn, void *pool_data,