[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231213-zswap-dstmem-v1-2-896763369d04@bytedance.com>
Date: Wed, 13 Dec 2023 04:17:59 +0000
From: Chengming Zhou <zhouchengming@...edance.com>
To: Andrew Morton <akpm@...ux-foundation.org>,
Nhat Pham <nphamcs@...il.com>, Chris Li <chriscli@...gle.com>,
Johannes Weiner <hannes@...xchg.org>,
Seth Jennings <sjenning@...hat.com>,
Dan Streetman <ddstreet@...e.org>,
Vitaly Wool <vitaly.wool@...sulko.com>,
Yosry Ahmed <yosryahmed@...gle.com>
Cc: Nhat Pham <nphamcs@...il.com>, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, Chengming Zhou <zhouchengming@...edance.com>
Subject: [PATCH 2/5] mm/zswap: change dstmem size to one page
Change the dstmem size from 2 * PAGE_SIZE to only one page since
we only need at most one page when compress, and the "dlen" is also
PAGE_SIZE in acomp_request_set_params(). If the output size > PAGE_SIZE
we don't wanna store the output in zswap anyway.
So change it to one page, and delete the stale comment.
Signed-off-by: Chengming Zhou <zhouchengming@...edance.com>
---
mm/zswap.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/mm/zswap.c b/mm/zswap.c
index edb8b45ed5a1..fa186945010d 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -707,7 +707,7 @@ static int zswap_dstmem_prepare(unsigned int cpu)
struct mutex *mutex;
u8 *dst;
- dst = kmalloc_node(PAGE_SIZE * 2, GFP_KERNEL, cpu_to_node(cpu));
+ dst = kmalloc_node(PAGE_SIZE, GFP_KERNEL, cpu_to_node(cpu));
if (!dst)
return -ENOMEM;
@@ -1662,8 +1662,7 @@ bool zswap_store(struct folio *folio)
sg_init_table(&input, 1);
sg_set_page(&input, page, PAGE_SIZE, 0);
- /* zswap_dstmem is of size (PAGE_SIZE * 2). Reflect same in sg_list */
- sg_init_one(&output, dst, PAGE_SIZE * 2);
+ sg_init_one(&output, dst, PAGE_SIZE);
acomp_request_set_params(acomp_ctx->req, &input, &output, PAGE_SIZE, dlen);
/*
* it maybe looks a little bit silly that we send an asynchronous request,
--
b4 0.10.1
Powered by blists - more mailing lists