Using kvzalloc and zram can benefit from huge page table mapping, so lets use kvzalloc_node/kvfree instead of vzalloc_node/vfree. Signed-off-by: Ze Zuo <zuoze1@xxxxxxxxxx> Signed-off-by: Kefeng Wang <wangkefeng.wang@xxxxxxxxxx> --- drivers/block/zram/zram_drv.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 692993e48e93..97241f166324 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -1249,7 +1249,7 @@ static void zram_meta_free(struct zram *zram, u64 disksize) zram_free_page(zram, index); zs_destroy_pool(zram->mem_pool); - vfree(zram->table); + kvfree(zram->table); } static bool zram_meta_alloc(struct zram *zram, u64 disksize) @@ -1257,13 +1257,14 @@ static bool zram_meta_alloc(struct zram *zram, u64 disksize) size_t num_pages; num_pages = disksize >> PAGE_SHIFT; - zram->table = vzalloc_node(array_size(num_pages, sizeof(*zram->table)), node_id); + zram->table = kvzalloc_node(array_size(num_pages, sizeof(*zram->table)), + GFP_KERNEL, node_id); if (!zram->table) return false; zram->mem_pool = zs_create_pool(zram->disk->disk_name); if (!zram->mem_pool) { - vfree(zram->table); + kvfree(zram->table); return false; } -- 2.25.1