Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751376AbbLJNC4 (ORCPT ); Thu, 10 Dec 2015 08:02:56 -0500 Received: from mga09.intel.com ([134.134.136.24]:56977 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750977AbbLJNCz convert rfc822-to-8bit (ORCPT ); Thu, 10 Dec 2015 08:02:55 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,408,1444719600"; d="scan'208";a="615824637" From: "Wang, Zhi A" To: "linux-kernel@vger.kernel.org" Subject: mm: some questions about mm/mempool.c Thread-Topic: mm: some questions about mm/mempool.c Thread-Index: AdEzSVLIBBwoRKmNTGWCp4yLyman8Q== Date: Thu, 10 Dec 2015 13:02:44 +0000 Message-ID: Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1471 Lines: 37 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/