From patchwork Sat Sep 28 02:16:14 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: 13814596 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 7DE04CF6493 for ; Sat, 28 Sep 2024 02:16:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E440F6B00D8; Fri, 27 Sep 2024 22:16:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DCC8C6B013F; Fri, 27 Sep 2024 22:16:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C46F96B0141; Fri, 27 Sep 2024 22:16:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 912D86B00D8 for ; Fri, 27 Sep 2024 22:16:28 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 26DA3AD017 for ; Sat, 28 Sep 2024 02:16:28 +0000 (UTC) X-FDA: 82612532856.30.86910F2 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) by imf28.hostedemail.com (Postfix) with ESMTP id 0D8FDC0004 for ; Sat, 28 Sep 2024 02:16:25 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=cfcrfeKw; spf=pass (imf28.hostedemail.com: domain of kanchana.p.sridhar@intel.com designates 192.198.163.13 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=1727489723; a=rsa-sha256; cv=none; b=IP7QcnXI9wX6ps2scltXDHgiVLUz4+j8ZMzFT0JNbipzBYdZGSNyAH+W8e5QTr1uD7YD9W M6ZDG2lm6NFgzGnIoh4xaC0/ZjBcDnwvotPamWyV6Nr+6L8Mm8ohSbJeaAbX3h9F2u3YvP M2bCDY2+hkkPvTdx2Vkd4iVL2JunfCA= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=cfcrfeKw; spf=pass (imf28.hostedemail.com: domain of kanchana.p.sridhar@intel.com designates 192.198.163.13 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=1727489723; 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=Xs4zWTZP+u35tfE3962xRZC7zEocizzc7guvsJWQ7y4=; b=UVIa86oKIvM/NHp/dGmAtilblQvCQoQJn6+6bvyE7/KgnHt9DFfh/ZmvPMCb3F8o57GcWW vwGyhaosP3zIm6W1++QllYZQ15Ih7nZdLWGr0tE/f9aYO3frqQwJLkXKidvbMBz7iYX6vX oieJov7UOGUzcSARwsESWpS5xv2dudk= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1727489786; x=1759025786; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KQeyC+P/mFswkiAsqAghN2A7u1uS+p3jOQ5BMPTPZHI=; b=cfcrfeKwGalh+ig2b+i7OD6/q3zziH8E3OXZEnqv7bWXWpqNG4U6xp9N 7oa3cPXxdIslgtBe3OC5HB2ZlVvlRUySDbV/8l8PkXfW5S3XS5JWS/oNk VVmSdHN8aNux11Lxo3uu0Sc5YymwOVjB1HybFBbo62UEoIOy9FVKJlFcb oOaI1rzi5mNc2EGr8CaA2NnohuIiwQxmt2ql4VHJNwvAxf7e63tYZabVl yuQRVrvKk30CU/6i1k8pBMxhAMy/Yh9w5IA0BKRkXTSDRzXF5V4obp09M WcUgsbxT34bEWYJk2oVWZaE12Thxh95Dug3Qdcgt5UGV6xQgAS4ezVOLZ A==; X-CSE-ConnectionGUID: 0udpuv7ATVC2BEy9NPOSrA== X-CSE-MsgGUID: 4azd4BHaSB2xnUxP5uNGow== X-IronPort-AV: E=McAfee;i="6700,10204,11208"; a="29526871" X-IronPort-AV: E=Sophos;i="6.11,160,1725346800"; d="scan'208";a="29526871" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Sep 2024 19:16:21 -0700 X-CSE-ConnectionGUID: n4rSEBVmS3m1aY2A58DlMA== X-CSE-MsgGUID: WdeSY2XgRu25oGb8CioSBw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,160,1725346800"; d="scan'208";a="73507114" Received: from jf5300-b11a338t.jf.intel.com ([10.242.51.6]) by orviesa008.jf.intel.com with ESMTP; 27 Sep 2024 19:16:21 -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 v8 2/8] mm: zswap: Modify zswap_compress() to accept a page instead of a folio. Date: Fri, 27 Sep 2024 19:16:14 -0700 Message-Id: <20240928021620.8369-3-kanchana.p.sridhar@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20240928021620.8369-1-kanchana.p.sridhar@intel.com> References: <20240928021620.8369-1-kanchana.p.sridhar@intel.com> MIME-Version: 1.0 X-Stat-Signature: itpi8bohcg9oa7edim8gj6j59hfth1ry X-Rspamd-Queue-Id: 0D8FDC0004 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1727489785-181420 X-HE-Meta: U2FsdGVkX19lqngvmfFaMpqinaInODbchK3xyZoS5BxFL6TMZeN18BqI1CVBNWIZZLJuGkEBnbumZ9Oh20AT8Im3sbX7VFbU2JfXG0JjA1h1QO3MlVR3For4ATCFFUM5iDFyb7IepwYwjST4mK+idlBPxqUWDl5mLtLmukp+Gbmgu/hWgBJhSYw3S1sqcq1yNfQZk8BTwgu0mrpWH3BqzDxgYz3pih7X6xoAvWL1Y6avocOUfs+DCS1La27DC1X33/kOxciWe0Yvi+TM/xZCpZxNYF/HSSIoX1E6p6jR++9noRMLMiNqnouJNrPIUSTwDghH9PyNJgKhrzL8hvsAJSjLGKvHtyTlkV39xZOC1TsMKYVU3bMrbSfLkw0Z5JeWdQsxwpoNyOMuVzeV+npz51ob6EB6I5meFWsgFFJYjlDu0Qe/1u2JWD5MqopDLzf3H1VJZAynkdGgmgRGYAxd6WM9KuxhPfrfqhFk0rD2iYwfPL57jfIjOf2PzaQyRkk38RfK6r5r7Sfxx34o0jeZFpFmm4GD4p0quk1XDGtGrPGvRkNX3qjobGjDOhR3zbVxnC2Ztjuw/S1KwCYMhwn9HJQkG/EqOgS7E0G7FuMWkAI0+Y5KzfowDdhOP18URw1eRJF8+CDAs+dsfBMm8o5RFJHHZlIBMYnNmUCeU3+rcfDdl1IPGLaGCuMD4owO3ggVrUG2Xq0bfYojSY4rnqfkEqV+L/J46O4zLWq0UPfa9WV2EGcxvibmahjC3tintfSfcLEdSE3TWMqm5jvCvOg/NpQIE6U7Fk2iPPOUS5BEd6MmYKNGNt+HXKVIl/dn2yGFQwLFIgeM6Q5WCI2k7sk9+15YDcN3f4VMoxJXZt6ly8A0GGv9Ol7JVj07ja/BOxtBMDttiv4JyGpSuhyUyXroOlXPpFD4YP+c31i698WoEh+xkL7N0WyFQ05kYNMFFu5kWigmnhLsjCfxCGkX4MA N7T1rqvx EMyjEB5ZJFc0Es3J8IH+m7ZtY8c5mbFEBIc4FPzq71cmCO3fApLGE/dlf/jqzQUBaDLAlPQJ5JlduARVG85/7QFzFAIOWX5GeeXpi0ZEp2JC0LkJ69O9zxym5/qFPmExPsrZXZVrl/Kilg3KheuWJSCFD2CKUZgw4U13I3h9s+h318BBWACxYi+L6GHJoQ0/AanM0b3BgL85a3MsFyEFUO8+2vhW+updSpA+ePaJXVcfH7uznJdrYL8OzjrWbF3g7xKfTb3y9TWJjW81t2ckYYbv0xw== 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 --- 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;