[<prev] [next>] [day] [month] [year] [list]
Message-ID: <F3B0350DF4CB6849A642218320DE483D4B860244@SHSMSX101.ccr.corp.intel.com>
Date: Thu, 10 Dec 2015 13:02:44 +0000
From: "Wang, Zhi A" <zhi.a.wang@...el.com>
To: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: mm: some questions about mm/mempool.c
Hi Gurus:
Currently we met some allocation failed in mempool_resize() ->
/* Grow the pool */
new_elements = kmalloc_array(new_min_nr, sizeof(*new_elements), // <---- Here
GFP_KERNEL);
if (!new_elements)
return -ENOMEM;
My questions:
1. It looks like in the pool creation path, the allocation of pool->elements is done by
mempool_t *mempool_create_node(int min_nr, mempool_alloc_t *alloc_fn,
mempool_free_t *free_fn, void *pool_data,
gfp_t gfp_mask, int node_id)
{
mempool_t *pool;
pool = kzalloc_node(sizeof(*pool), gfp_mask, node_id);
if (!pool)
return NULL;
pool->elements = kmalloc_node(min_nr * sizeof(void *),
gfp_mask, node_id);
but in the mempool_resize() path, the pool->elements is allocated by kmalloc_array() without NUMA aware. Is it correct?
And I think perhaps a vzalloc here may be more reasonable, as the amount of pool->elements may be large and kmalloc here may fail.
2. Shall we need a mempool_refill() function that can recharge the pool at a certain time?
Thanks,
Zhi.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists