diff options
author | Huang Shijie <sjhuang@iluvatar.ai> | 2019-01-03 15:26:51 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-12-05 15:27:03 +0100 |
commit | de6d2fff511a9687b7278bf31685ae4395842268 (patch) | |
tree | d312e4475dab439bb299e5cd40206c0032651af6 /lib | |
parent | a7965e6aa6ead68442f67bb3b5d5e3777b3c0222 (diff) | |
download | linux-stable-de6d2fff511a9687b7278bf31685ae4395842268.tar.gz linux-stable-de6d2fff511a9687b7278bf31685ae4395842268.tar.bz2 linux-stable-de6d2fff511a9687b7278bf31685ae4395842268.zip |
lib/genalloc.c: use vzalloc_node() to allocate the bitmap
[ Upstream commit 6862d2fc81859f88c1f3f660886427893f2b4f3f ]
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
it.
Link: http://lkml.kernel.org/r/20181225015701.6289-1-sjhuang@iluvatar.ai
Signed-off-by: Huang Shijie <sjhuang@iluvatar.ai>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Alexey Skidanov <alexey.skidanov@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/genalloc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/genalloc.c b/lib/genalloc.c index e4303fb2a7b2..38764572ddde 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); |