[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230901071942.207010-3-zuoze1@huawei.com>
Date: Fri, 1 Sep 2023 15:19:42 +0800
From: Ze Zuo <zuoze1@...wei.com>
To: <minchan@...nel.org>, <senozhatsky@...omium.org>, <axboe@...nel.dk>
CC: <akpm@...ux-foundation.org>, <ying.huang@...el.com>,
<aneesh.kumar@...ux.ibm.com>, <linux-mm@...ck.org>,
<linux-kernel@...r.kernel.org>, <linux-block@...r.kernel.org>,
<wangkefeng.wang@...wei.com>, <zuoze1@...wei.com>
Subject: [PATCH 2/2] zram: take the benefit of kvzalloc_node
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@...wei.com>
Signed-off-by: Kefeng Wang <wangkefeng.wang@...wei.com>
---
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
Powered by blists - more mailing lists