From: Huang Shijie <sjhuang@iluvatar.ai> To: <akpm@linux-foundation.org> Cc: <sfr@canb.auug.org.au>, <alexey.skidanov@intel.com>, <linux-kernel@vger.kernel.org>, <shijie8@gmail.com>, Huang Shijie <sjhuang@iluvatar.ai> Subject: [PATCH 1/2 fix] lib/genalloc.c: Use the vzalloc_node to allocate the bitmap. Date: Tue, 25 Dec 2018 09:57:01 +0800 Message-ID: <20181225015701.6289-1-sjhuang@iluvatar.ai> (raw) In-Reply-To: <20181224070622.22197-1-sjhuang@iluvatar.ai> Some devices may have big memory on chip, such as over 1G. In some cases, the nbytes maybe bigger then 4M which is the bounday of the memory buddy system (4K default). So use vzalloc_node() to allocate the bitmap. Also use vfree to free the it. Signed-off-by: Huang Shijie <sjhuang@iluvatar.ai> --- The v1 did not free the memory with vfree. This patch fixes it. --- lib/genalloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/genalloc.c b/lib/genalloc.c index 5deb25c40a5a..f365d71cdc77 100644 --- a/lib/genalloc.c +++ b/lib/genalloc.c @@ -187,7 +187,7 @@ int gen_pool_add_virt(struct gen_pool *pool, unsigned long virt, phys_addr_t phy int nbytes = sizeof(struct gen_pool_chunk) + BITS_TO_LONGS(nbits) * sizeof(long); - chunk = kzalloc_node(nbytes, GFP_KERNEL, nid); + chunk = vzalloc_node(nbytes, nid); if (unlikely(chunk == NULL)) return -ENOMEM; @@ -251,7 +251,7 @@ void gen_pool_destroy(struct gen_pool *pool) bit = find_next_bit(chunk->bits, end_bit, 0); BUG_ON(bit < end_bit); - kfree(chunk); + vfree(chunk); } kfree_const(pool->name); kfree(pool); -- 2.17.1
prev parent reply index Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-12-24 7:06 [PATCH 1/2] " Huang Shijie 2018-12-24 7:06 ` [PATCH 2/2] lib/genalloc.c: export symbol addr_in_gen_pool Huang Shijie 2018-12-28 5:49 ` Andrew Morton 2018-12-28 7:45 ` Huang Shijie 2019-01-03 7:55 ` Christoph Hellwig 2019-01-03 10:11 ` Huang Shijie 2019-01-03 15:37 ` Christoph Hellwig 2018-12-25 1:57 ` Huang Shijie [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20181225015701.6289-1-sjhuang@iluvatar.ai \ --to=sjhuang@iluvatar.ai \ --cc=akpm@linux-foundation.org \ --cc=alexey.skidanov@intel.com \ --cc=linux-kernel@vger.kernel.org \ --cc=sfr@canb.auug.org.au \ --cc=shijie8@gmail.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
LKML Archive on lore.kernel.org Archives are clonable: git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git git clone --mirror https://lore.kernel.org/lkml/8 lkml/git/8.git git clone --mirror https://lore.kernel.org/lkml/9 lkml/git/9.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \ linux-kernel@vger.kernel.org public-inbox-index lkml Example config snippet for mirrors Newsgroup available over NNTP: nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel AGPL code for this site: git clone https://public-inbox.org/public-inbox.git