linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Ze Zuo <zuoze1@huawei.com>
To: <minchan@kernel.org>, <senozhatsky@chromium.org>, <axboe@kernel.dk>
Cc: <akpm@linux-foundation.org>, <ying.huang@intel.com>,
	<aneesh.kumar@linux.ibm.com>, <linux-mm@kvack.org>,
	<linux-kernel@vger.kernel.org>, <linux-block@vger.kernel.org>,
	<wangkefeng.wang@huawei.com>, <zuoze1@huawei.com>
Subject: [PATCH 2/2] zram: take the benefit of kvzalloc_node
Date: Fri, 1 Sep 2023 15:19:42 +0800	[thread overview]
Message-ID: <20230901071942.207010-3-zuoze1@huawei.com> (raw)
In-Reply-To: <20230901071942.207010-1-zuoze1@huawei.com>

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@huawei.com>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.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



      parent reply	other threads:[~2023-09-01  7:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-01  7:19 [PATCH 0/2] zram: support for specific numa node for zram Ze Zuo
2023-09-01  7:19 ` [PATCH 1/2] zram: add a parameter "node_id" " Ze Zuo
2023-09-02 22:55   ` Andrew Morton
2023-09-05  5:01   ` Sergey Senozhatsky
2023-09-01  7:19 ` Ze Zuo [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=20230901071942.207010-3-zuoze1@huawei.com \
    --to=zuoze1@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=senozhatsky@chromium.org \
    --cc=wangkefeng.wang@huawei.com \
    --cc=ying.huang@intel.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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox