Skip to contentSkip to conversation

mm: mempool: Factor out mempool_refill()

PATCH New Zhi Wang 1 participant 1 message Dec 11, 2015

Subsystems (2)
lore
Share & tools
lore

Zhi Wang

author
#0 lore raw

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().

---
 include/linux/mempool.h |  1 +
 mm/mempool.c            | 61 ++++++++++++++++++++++++++++++++++++-------------
 2 files changed, 46 insertions(+), 16 deletions(-)
include/linux/mempool.h +1 -0
index 69b6951..71f7460 100644
@@ -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