From patchwork Tue Oct 1 05:32:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kanchana P Sridhar X-Patchwork-Id: 13817482 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 6E272CEB2FD for ; Tue, 1 Oct 2024 05:37:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 101106B00C4; Tue, 1 Oct 2024 01:37:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 013FC6B00C5; Tue, 1 Oct 2024 01:37:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DFB5A6B00CC; Tue, 1 Oct 2024 01:37:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id C1B236B00C4 for ; Tue, 1 Oct 2024 01:37:13 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 7CDFE40C84 for ; Tue, 1 Oct 2024 05:37:13 +0000 (UTC) X-FDA: 82623925146.21.E326DBA Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) by imf05.hostedemail.com (Postfix) with ESMTP id 072D6100006 for ; Tue, 1 Oct 2024 05:37:10 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=WGbGidHP; spf=pass (imf05.hostedemail.com: domain of kanchana.p.sridhar@intel.com designates 192.198.163.11 as permitted sender) smtp.mailfrom=kanchana.p.sridhar@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1727760904; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=22u3xN6mg06byfZK8t7nFX35eMVdhAnR4N1qjCNuJIE=; b=32Mrc05vVcEtW7OeR3q1mtKmAvyLnRV3k54fCiqQmXqd180x3WhsCf6yRkYZOIdnGpyXDz Dun9xdX/xzcQrAUL8SKbTaVhozx3b9eRCvSlM1cG3DVkXC5ZUDfnHKp0Mlr4rHry5e7y38 YLxEjAUIo6cF0xwYFR3ilSsMvjnsn5s= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1727760904; a=rsa-sha256; cv=none; b=TMfaaVCO/IzLWVf/BQLxejG7lYjL4t+WntvAFwoXN2hYlVuUMNNlMKNq/X5d2MBIDVAGyu 8Rtf9IUmDGRtDQY1h6tVYKsPbJBgOeh18XCLll5d8k5X+d1sdvXwYjiWq//vsaqwOhqk86 bUW3quStWklvTjruMg2td9zSPSaE4A0= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=WGbGidHP; spf=pass (imf05.hostedemail.com: domain of kanchana.p.sridhar@intel.com designates 192.198.163.11 as permitted sender) smtp.mailfrom=kanchana.p.sridhar@intel.com; dmarc=pass (policy=none) header.from=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1727761031; x=1759297031; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=efGW2zzH8VCItzcrEw7X5/h61cbLWY8/tK2pA3rWPZo=; b=WGbGidHPsdCy4HetmUxJ/jmBtQlS82EvUlXps4gy2jqxqwTcsgMWpCye PyIPny4eEEst33WL44d9PAYAZ1Fp/uZf8JmNeAx8W00ZThOSdlQwRT8aT ZSV1DB8rmJoCq8cK5mCM4577XdHzL1kd2A3YAp53L5r7KfyKKTH69bAB/ CwvfSiZF38L2s+TC6/8lUTHByMl6l19/KeUYLSp9Ldpl6/prTyeQ2GAVa Q7nhBXbAuLO3G3FhGt8TwT5pXBPjhLssJej8Sj2R644GtNpxpOKT8InnW kQCNoYIITb8Fy1mtOpxQHprO+x3SLhVtny8MR/pYbML15kvt3041i446Y A==; X-CSE-ConnectionGUID: EjlLjs5zQlGQJnPx8FtzWg== X-CSE-MsgGUID: hj8LwCaaT4WshtYVzIKLVw== X-IronPort-AV: E=McAfee;i="6700,10204,11211"; a="37465081" X-IronPort-AV: E=Sophos;i="6.11,167,1725346800"; d="scan'208";a="37465081" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Sep 2024 22:32:24 -0700 X-CSE-ConnectionGUID: w49pgGxrSHOs/Gotpi9JWA== X-CSE-MsgGUID: AyNh3wxhT7C8wmJiQpdeOg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,167,1725346800"; d="scan'208";a="73205798" Received: from jf5300-b11a338t.jf.intel.com ([10.242.51.6]) by fmviesa007.fm.intel.com with ESMTP; 30 Sep 2024 22:32:24 -0700 From: Kanchana P Sridhar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org, hannes@cmpxchg.org, yosryahmed@google.com, nphamcs@gmail.com, chengming.zhou@linux.dev, usamaarif642@gmail.com, shakeel.butt@linux.dev, ryan.roberts@arm.com, ying.huang@intel.com, 21cnbao@gmail.com, akpm@linux-foundation.org, willy@infradead.org Cc: nanhai.zou@intel.com, wajdi.k.feghali@intel.com, vinodh.gopal@intel.com, kanchana.p.sridhar@intel.com Subject: [PATCH v10 2/7] mm: zswap: Modify zswap_compress() to accept a page instead of a folio. Date: Mon, 30 Sep 2024 22:32:17 -0700 Message-Id: <20241001053222.6944-3-kanchana.p.sridhar@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20241001053222.6944-1-kanchana.p.sridhar@intel.com> References: <20241001053222.6944-1-kanchana.p.sridhar@intel.com> MIME-Version: 1.0 X-Stat-Signature: qfugxpjh6gfopmcehiibrtuxnzn1ek1u X-Rspamd-Queue-Id: 072D6100006 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1727761030-760771 X-HE-Meta: U2FsdGVkX18KM3BcZH+KEehx8yWCLO8JCiMWoEi6uxg7K2q5DnqWqSfCk4D8JDHbRIwdCrh8pF9IOeygMmPc1tqIfvYR9ZRXiQTXIS08n7lgpM6JuLwc3xf3VWWHyNd03HTmX8decGLbWb+xWvfPjvHjfwZD6RJxuFmS2y3fwqDUTJxs0bhY/LK68gGILi2oTfWsCs56PGOFgOozuXHv37lyG5w9OKPMA8taim4Eo49vzdyh10Stt7gdNVC4wKixMtPd35Uf7wbB7tBrlh2LgC3O5dSvAirEyyjkDJv2gcSnos5cYh+FQTW7iOc3SKNPmB1svyP3HARd4riJppOa8sFsl8C6Aus/+94jj8uZ4j6j9/cFMxC1zndsjENazP0N28C1GoWo4em3BUWPqmvQGtrTQeRH9TU88hCHu88DNUybOtvoXaDFfHxa0yQrp+CTr4YKh61UQCZcPiuSTq1qDQtAK18iAz7IUMBd2KaVZYhMj4+Mi4/L6uMGcsST4NJdWcWN3HN9I13W0Hl8lU7NWZwzgcPn0hVsPH+Q0bh4np9pecdCcR6kZXcdcSRQyp5o+DrFybqX7xC14gE41WVvs1sZcELN8SEuguIw6MMa3zBzekeOxz77nwUp/CwOkEOVnYrWQogjvZ9YR3LT4rMRGybqTXzE1l5JRnWWhFRrdyDZg6oktmrf+dHOD57BFZli45yjx4QcOf7vo/0XzzzKdanbNoiHTF10SaJ3eIfPUMDgP7j7//4YqQm2l4SfuBuXjGM0R9ms2SUWi+JRzpi/Es6E0gVS6VrhRwoKAfTUHRsZZmjIzJPmqLR9/slnAp4v6lICZiBXTfWYTEJ0Rq/iOK5X/Yb2b6rL40ZUqD0dyDbFXNjoeeNhboU43oVh3NDH7pVSxRB+SCZQrLJGWjodM0Vt5cPzO5s/FPTpBSClSg5TAhP+jKjGL7f7Jt+ADRz7jHYYDTVtnffeeYWW2C0 tx2BTP5y Fjq9I9FCaZ1NIWS2jKJ27JjPGBEUK7I/bsBST5cSDawEs6ja3+UALiCKKs7P9idHNEtRc7tUeVPMGYRbjA7HrEe6j5HND/UfdayK35D25OSc5QyrZ10kRECfrKnPgADLQBVkjWotkxkzGdCLAwTALIVAqIeyCof3aBw0XiCbA9h8wnj0hj3htWXM3wcv516c5rO7bQr/5EEY/DqpBRfXYGR/Ubl5LenH1moNqy22Rj/pYNuBQvs+mO9aOUZxNGNzfyuzXZjOLQ+qtzttWwfXyQJxufzYOXzf1t0Kpw6xCubDZsNVdfl3ibF5kHi12fCKhNNhgnzTkICgZMNdmOGoZoy/chVpH5CI+MbF6jQUM2Sl2HLw= 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: For zswap_store() to be able to store a large folio by compressing it one page at a time, zswap_compress() needs to accept a page as input. This will allow us to iterate through each page in the folio in zswap_store(), compress it and store it in the zpool. Signed-off-by: Kanchana P Sridhar Reviewed-by: Nhat Pham Reviewed-by: Chengming Zhou Acked-by: Johannes Weiner Acked-by: Yosry Ahmed --- mm/zswap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/zswap.c b/mm/zswap.c index efad4e941e44..fd7a8c14457a 100644 --- a/mm/zswap.c +++ b/mm/zswap.c @@ -875,7 +875,7 @@ static int zswap_cpu_comp_dead(unsigned int cpu, struct hlist_node *node) return 0; } -static bool zswap_compress(struct folio *folio, struct zswap_entry *entry) +static bool zswap_compress(struct page *page, struct zswap_entry *entry) { struct crypto_acomp_ctx *acomp_ctx; struct scatterlist input, output; @@ -893,7 +893,7 @@ static bool zswap_compress(struct folio *folio, struct zswap_entry *entry) dst = acomp_ctx->buffer; sg_init_table(&input, 1); - sg_set_folio(&input, folio, PAGE_SIZE, 0); + sg_set_page(&input, page, PAGE_SIZE, 0); /* * We need PAGE_SIZE * 2 here since there maybe over-compression case, @@ -1456,7 +1456,7 @@ bool zswap_store(struct folio *folio) mem_cgroup_put(memcg); } - if (!zswap_compress(folio, entry)) + if (!zswap_compress(&folio->page, entry)) goto put_pool; entry->swpentry = swp;