mm: mempool: Factor out mempool_refill()
Subsystems (2)
PATCH 1/1 mm: mempool: Factor out mempool_refill()
This patch factors out mempool_refill() from mempool_resize(). It's reasonable that the mempool user wants to refill the pool immdiately when it has chance e.g. inside a sleepible context, so that next time in the IRQ context the pool would have much more available elements to allocate.
After the refactor, mempool_refill() can also executes with mempool_resize() /mempool_alloc/mempool_free() or another mempool_refill().
Signed-off-by Zhi Wang <[email protected]>
--- include/linux/mempool.h | 1 + mm/mempool.c | 61 ++++++++++++++++++++++++++++++++++++------------- 2 files changed, 46 insertions(+), 16 deletions(-)
include/linux/mempool.h +1 -0
@@ -30,6 +30,7 @@ extern mempool_t *mempool_create_node(int min_nr, mempool_alloc_t *alloc_fn, gfp_t gfp_mask, int nid);extern int mempool_resize (mempool_t *pool,int new_min_nr); +extern void mempool_refill (mempool_t *pool);extern void mempool_destroy (mempool_t *pool);extern void *mempool_alloc (mempool_t *pool,gfp_t gfp_mask);extern void mempool_free (void *element,mempool_t *pool);
mm/mempool.c +45 -16
80 lines not on this page · raw message
Signature · 1 line
1.9.1