From patchwork Wed Dec 6 09:46:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chengming Zhou X-Patchwork-Id: 13481321 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A7A0C4167B for ; Wed, 6 Dec 2023 09:46:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 954A86B00A3; Wed, 6 Dec 2023 04:46:43 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 866C66B00A4; Wed, 6 Dec 2023 04:46:43 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 707C66B00A5; Wed, 6 Dec 2023 04:46:43 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 5B8E46B00A3 for ; Wed, 6 Dec 2023 04:46:43 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 3528812015D for ; Wed, 6 Dec 2023 09:46:43 +0000 (UTC) X-FDA: 81535913886.15.B93319F Received: from out-189.mta1.migadu.com (out-189.mta1.migadu.com [95.215.58.189]) by imf29.hostedemail.com (Postfix) with ESMTP id 51FC4120027 for ; Wed, 6 Dec 2023 09:46:41 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=bytedance.com (policy=quarantine); spf=pass (imf29.hostedemail.com: domain of chengming.zhou@linux.dev designates 95.215.58.189 as permitted sender) smtp.mailfrom=chengming.zhou@linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1701856001; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=d6GiiHeHVcS7kukNT2gh1iXVRWGkIYl7tyaTuuFP/Ak=; b=eSCE/I0GjhJx9eMfRNPAh0xBjsLCMEflVXwmOKBJWF4oChHQ14HJjv0uoV11VLr2SyHjcR y3+UDqvvPNUgyAKPX6+HBWjVAswEhJnO+doxSeOvDa+vGL7Ri/rjQTZFHGgcg2n53fAB6v CCN31/9LvDafz9aKYJuxfayZsqQguCk= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=bytedance.com (policy=quarantine); spf=pass (imf29.hostedemail.com: domain of chengming.zhou@linux.dev designates 95.215.58.189 as permitted sender) smtp.mailfrom=chengming.zhou@linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1701856001; a=rsa-sha256; cv=none; b=YOpjFQWdfvHTk9K9PWU8LFihuP5nFIsB3gTh4oKNqzPa0AmcK0JvsvwXA7qafV5eW47jD2 T+J9dK+nyaigBvkmzF+UBG4RFwk9qm/6N3uwckxwXsGVttVUl0MweG2NvXOfdpEUZk9WaV fhblw0v8u7tBpO/IxAoBWHzDfn16Tj0= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Chengming Zhou Date: Wed, 06 Dec 2023 09:46:27 +0000 Subject: [PATCH 4/7] mm/zswap: change dstmem size to one page MIME-Version: 1.0 Message-Id: <20231206-zswap-lock-optimize-v1-4-e25b059f9c3a@bytedance.com> References: <20231206-zswap-lock-optimize-v1-0-e25b059f9c3a@bytedance.com> In-Reply-To: <20231206-zswap-lock-optimize-v1-0-e25b059f9c3a@bytedance.com> To: Vitaly Wool , Nhat Pham , Johannes Weiner , Michal Hocko , Seth Jennings , Dan Streetman , Andrew Morton , Yosry Ahmed Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Chengming Zhou X-Developer-Signature: v=1; a=ed25519-sha256; t=1701855988; l=1265; i=zhouchengming@bytedance.com; s=20231204; h=from:subject:message-id; bh=HqwNJM8tE/N/sls10yfGIW7SQYFQNs7CH/U23vKZJJA=; b=vLSavMUZY2NbU7Ht3zXNimzw+b1It8sOxPqmY7gDO7tM7+foam8clg5CtKs4bOcNaCYz3xPso WsTwNYwXlA9BQKJg3zkaJ53yg9R0yBfDoIjVp0o2j0FWuC1shqBwv4r X-Developer-Key: i=zhouchengming@bytedance.com; a=ed25519; pk=xFTmRtMG3vELGJBUiml7OYNdM393WOMv0iWWeQEVVdA= X-Migadu-Flow: FLOW_OUT X-Rspamd-Queue-Id: 51FC4120027 X-Rspamd-Server: rspam02 X-Rspam-User: X-Stat-Signature: 7mgio54ywh6ipqsc8zt4osca1ds71ys9 X-Rspamd-Pre-Result: action=add header; module=dmarc; Action set by DMARC X-Rspam: Yes X-HE-Tag: 1701856001-54096 X-HE-Meta: U2FsdGVkX18eLkuBYMlu51rODMDBzkAFRinfN/eqMtkeBd0UrXAO52WkW162L8Zu6MF9YdWUDoms7HdlZb7xrmYe3ycALAZYT9QZ79FJMSkt/FoTiHqV3G3/qOpu0jWeaScT4+9k9istNbZKj65Egr0sN2VzqfqE0FBlUVitUoznIh3VySvVOXKA2PloiM49kPQZ44/LX82P/zsgJfGplmCJmg4mL+YrbnOBUdfHPO1iTVTa5i69Qi6p/rrlARt+RAZGc2kcf6Xh4AI9VRJU+gUALDP35gLyv6xItNdW4d6ZjiGpC1OhUYs9fzusIXZ2i3fPbBQ4C5H/exSbOgBTHKUeI6Bm6s53z3JmQi7NeoEtPUFq7ss3+CS9wRYHlxCT2JrqaVWC2XaS4jgIUYo1/LITEXuao4tNToqKEMZC+0SNTBcJVLxVwwWDVZG1NthfRU13qMHYnJ1bRtnIlxW9oiXrsEnwdJ3CgUA+NbrN0qKP2zx028FKwBJCE8IKYA844sDg7g94gH1jbVomwBBR549nYlZf/wNrZvyGfuNZLzCygm0Ev9+c0NLaCqRzL2Af3dpq4odWKMywacV+yqaskCqyIu6VvvwJhZXn3KV9StT9bb6kCgP2+7IRXat3k+JsgG4cI/Fs5WX83Bzg0Vo6OP2+wRLa21D9TEhN8EkFVtx5UY1C04c0eUrGiqh9NmA6JMhy0KA7RmQG5HwhLJMp0YhH5+uuxw8kgj8spVUL3A3vSm+Ok4n9XseOlQcALQPbC8RZAkyoObvxdRrtDfyUUkwhbkVDqIsXdcY8mcxhYCFd9sSvb5iyeKWoY/rOiluYlSyQGf/yk1ZLEhOW5tEbuhzdMaAGFRg6rFXRN3tGbGghqErjHtBtbZqOo7N8d10pG6qXRQ7/c6MmD7yf75VgKSuSPxr2KJdHTF8XjupOSYKXbRQFuVPkUvJpBGgLak0w1bP4oWn4e5e5oGsdnqI kUG9HF21 lPuCNdo1y/+dFCc2vdGHFzs83rPEvAzcPHs4UwR2al8brmkwPUFfm4bATPuT+wP/714txpxnyK+NZuuFlWSJcWmuQY5DGZuMwZfsTD2pChtEyzLI1Jejkh+jMkSGIhsNRjVSy/HjgE6ioIDT6pLcKqDxBb8VIkZ+7QO1dDC5pe05IzLlBmbY/C78eBTiPGnNd0njdsEXuDl6BvoOvF9uBHf3qymkJ/p/TuJGVWRZ1ioNxl1bjabJxWODn+cK4N5FvIX8XUTantFogkmzQAx4C7px8OJ23MHUr+cgote3w2bPuLNOsUDM39ybdnH8+hPKLWjKlkrUWuggs4Q4= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Maybe I missed something, but the dstmem size of 2 * PAGE_SIZE is very confusing, since we only need at most one page when compress, and the "dlen" is also PAGE_SIZE in acomp_request_set_params(). So change it to one page, and fix the comments. Signed-off-by: Chengming Zhou --- mm/zswap.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mm/zswap.c b/mm/zswap.c index d93a7b58b5af..999671dcb469 100644 --- a/mm/zswap.c +++ b/mm/zswap.c @@ -699,7 +699,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; @@ -1649,8 +1649,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,