From patchwork Tue Sep 24 01:17:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sridhar, Kanchana P" X-Patchwork-Id: 13810015 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 9817CCF9C73 for ; Tue, 24 Sep 2024 01:17:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A8A0F6B0085; Mon, 23 Sep 2024 21:17:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A14056B0088; Mon, 23 Sep 2024 21:17:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8B3FA6B0089; Mon, 23 Sep 2024 21:17:19 -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 711426B0085 for ; Mon, 23 Sep 2024 21:17:19 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id F0B56816A6 for ; Tue, 24 Sep 2024 01:17:18 +0000 (UTC) X-FDA: 82597868556.18.288DE8E Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) by imf09.hostedemail.com (Postfix) with ESMTP id DABD1140007 for ; Tue, 24 Sep 2024 01:17:16 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b="CC8qCu/Q"; spf=pass (imf09.hostedemail.com: domain of kanchana.p.sridhar@intel.com designates 192.198.163.12 as permitted sender) smtp.mailfrom=kanchana.p.sridhar@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1727140576; a=rsa-sha256; cv=none; b=uw4u3EaAIvKK6igGN1ZhBErcAMZIKf2obFSyskIgUZUcfqTvx4Uq8eUGKSohrRARuiZeZC Q7A6R8uXWChCWZI77SlVFCPGOePGt7u9YOFRK062Qcq6O0nsWjXV0NZmCAYX3+9RCerQKZ rwc6qA3SDVVnokSYj6BuVjHrdEZut4w= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b="CC8qCu/Q"; spf=pass (imf09.hostedemail.com: domain of kanchana.p.sridhar@intel.com designates 192.198.163.12 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=1727140576; 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=omR98ZCGNxhbtkybxIwrYfvGrA5EOSYSIR72vJ7FVis=; b=S5nuArcmX8lnPznvjRIbez870+45vcQTPrJ6MTVI+SPk6CXPRaDAindZpjaF16i66rI6Wj F/oWqv4ngNqcj7RYNGza6JksV0BeKnImisbCHc1p3/NFR7199QMc3VuuMFzf9oBXVyVwsI gnIRhZAej3Sb9uRFnbLTZDVGP9AvyEA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1727140637; x=1758676637; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=pUUdV92IiG6zC8GNm5xDbVEXW5oShMyaugmREkMxm7k=; b=CC8qCu/QRNq4iA5WbLNloPb6b60wDN8IGOT6QPcssjDbmum6Kdu6t6rQ tscMTapGbNj0grwARTiLDL3Y77QugnTFHxqyuoSK3c9vF0nO81TiUIbPw 1jy7S1Wyxast4mbrhfYYYUW21JpclBxQb/EaAt1apHFinmADK+1UDqWTl jjvnR6gNfGPKoNZOy8tbfbmjxbY6BuNkMXeFENnGUDgyuXvf5b/T8itzz fJP37HyFB3PAlm1qZXGPSFCUDJcsHPuz9KGrCHYPS8t57A+5mUjK7bkM5 vDOEDDJYKYFG7kXQ0AU+J5DwApE2iXP4QrEG2UB+PHGZo9itdt0QT67nn g==; X-CSE-ConnectionGUID: F27bXeUoQK2V5hQ+N80vyg== X-CSE-MsgGUID: 3fTQP7r3SmqNzqLDoBjeCQ== X-IronPort-AV: E=McAfee;i="6700,10204,11204"; a="30002009" X-IronPort-AV: E=Sophos;i="6.10,253,1719903600"; d="scan'208";a="30002009" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Sep 2024 18:17:10 -0700 X-CSE-ConnectionGUID: Ow60v4ymQFG6hfj4EMYAUA== X-CSE-MsgGUID: HuTf+8mJT82ukI2RZ+87ug== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,253,1719903600"; d="scan'208";a="108688447" Received: from jf5300-b11a338t.jf.intel.com ([10.242.51.6]) by orviesa001.jf.intel.com with ESMTP; 23 Sep 2024 18:17:10 -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 Cc: nanhai.zou@intel.com, wajdi.k.feghali@intel.com, vinodh.gopal@intel.com, kanchana.p.sridhar@intel.com Subject: [PATCH v7 2/8] mm: zswap: Modify zswap_compress() to accept a page instead of a folio. Date: Mon, 23 Sep 2024 18:17:03 -0700 Message-Id: <20240924011709.7037-3-kanchana.p.sridhar@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20240924011709.7037-1-kanchana.p.sridhar@intel.com> References: <20240924011709.7037-1-kanchana.p.sridhar@intel.com> MIME-Version: 1.0 X-Stat-Signature: fxx61esoey56pbdac3abxyq1ewefecsh X-Rspamd-Queue-Id: DABD1140007 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1727140636-890141 X-HE-Meta: U2FsdGVkX19dEdfGJNwt7+ouCbtoi+Dhrj6NGT7ePApqquPQaJpzJF893NDM/0oPW9mUT71+pFDEyuph6cvVoBToSRFmSjhVsWXngwvvtRLKXQre9pi3K2lPg1kj13n/UwtVSS23Ck7Kev7n0R7S4k1kEfkER1LTmz+kJiPFSdQEEFnDQYephKs55lkAqk4PdsB+OzBsDHq4qlCNqKxW5K/bgL6ua7Dg21I0CRjOExzMF2Rg+SiajbX3ZsNUQZZR+GI9uP6/iS3LlmJZAjz86Egay8VpbmvarMYr86rHVV3N5rjf5NXVMA1Pwv5/4VTI1PQvPZeCRiAQ0xFsAHJ8kW832+/0/397JvWHcfvfF1/75gtfEVd75nD8gqPIJYHKgOm73TnZTmTxU4jE/bVbyvdQ6oRW1P/cHxKj9Rhyd9Bpv7Y5w1+mNG59A1yFJ4mm7TC56SokjuqJh+jtvGa2gnzqyQvtLgpbF+4ouXw0P5AZz4Zo47zTVF+05VTrwBLHHLKjgW8PrPDeuytoJSzW9c1iMgcWswCGqO4JIKrKyI5GVJsbgKpYxYlypfOU6dZSvDqD6t/K9cS8aMOmRPUlE5ZpZYJLITOyhPVoghhLE85SAvcpqyibhOFLWmEvOCBLahqsFbNs3kAapgHsT4dQdFtW6u9uoJFsBsn8XBIlJXSzcsujTKWcwyjr8tiwj7HVd8cwuCwtdZbWOho1VhG388y5EgThZmn2Y1+InhTpwPJ8z3POh8TTFrPbYt+RSKU9FJPJBahgBYqdtUxl2gEVfOs2ywewn4kGS4J+gHuEn9s/X4cSlUoKzLYtVmh0FMDyc+SaKjhWX7ors4iFpkv6Q73afnTZfHSC87ZD9y8RsImAJWerOlkDFqw5gGtmqjupMOv1SjRo/0WgCORQlb+QewWsREQMxGDWmkPfgjeFsIwIDWiaRsmBUtn6WPb4h7Kh5wWCe+ZIxv38XZNIHWX FNtmKKJy uU2xOHDX0gCEQUX9faEhBwlMTcrZqEFoDdVmPkqdo+ogACfuV7eBpPZiFPYCt0Wboy8DBm9M3vDmXeIqqJc0iqlK7KrS5q8k3R7Ux7GBwLgqWWIKxQuDeNV9W98DS6OGC4bZ+hlsSCTQlDVz0kuLYfSfD5RVUJu3XOYtbdJLCZP7Y+KlGlEng8XwkVmWfGiiARSJ8+gMyblvMzi93CDJk5/qKCqOrd8Z16kvIEkKcp3004rqIYgFnjvyLcJLkn6O9t1Va 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 an mTHP 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 mTHP in zswap_store(), compress it and store it in the zpool. Signed-off-by: Kanchana P Sridhar Reviewed-by: Nhat Pham --- mm/zswap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/zswap.c b/mm/zswap.c index 449914ea9919..59b7733a62d3 100644 --- a/mm/zswap.c +++ b/mm/zswap.c @@ -876,7 +876,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; @@ -894,7 +894,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, @@ -1458,7 +1458,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;