From patchwork Mon Sep 30 22:12:16 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: 13817144 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 D40A8CEB2CB for ; Mon, 30 Sep 2024 22:12:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C42FF280032; Mon, 30 Sep 2024 18:12:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BC9AF28002D; Mon, 30 Sep 2024 18:12:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A1C00280032; Mon, 30 Sep 2024 18:12: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 856AB28002D for ; Mon, 30 Sep 2024 18:12:28 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 3AE2F1C6343 for ; Mon, 30 Sep 2024 22:12:28 +0000 (UTC) X-FDA: 82622804376.19.AECB008 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by imf03.hostedemail.com (Postfix) with ESMTP id 16CB12000B for ; Mon, 30 Sep 2024 22:12:25 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=Lv6I4vqV; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf03.hostedemail.com: domain of kanchana.p.sridhar@intel.com designates 198.175.65.9 as permitted sender) smtp.mailfrom=kanchana.p.sridhar@intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1727734243; a=rsa-sha256; cv=none; b=Azb56xE+oMHS+NMteYcOAl4WzkrqOpofa/olJ+2075zmSiNBpMiHUZht6XsJCZEepjCNP6 1YKoORQu68werQnHcGf7fJpKAccp5B8HggXyWwyj04obko8dtk3wAD+Hp6q5al9WacIXR7 V5mYluZlz9iHCc36wIgZL3QS2V/wgQQ= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=Lv6I4vqV; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf03.hostedemail.com: domain of kanchana.p.sridhar@intel.com designates 198.175.65.9 as permitted sender) smtp.mailfrom=kanchana.p.sridhar@intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1727734243; 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=+SbmJ6A8PBY8eei7zu0r5gtPlPGA5g+RZGIYnfbGGqQ=; b=pnTBIVrN6porjinWU3F7+map6QadbZ+WcnmBfWz5PjstEXAicA3phJmxB++O622Q/gZoXO Tr01LhGOU9ppToSTLL6r2bqwncdVipqUcb1fYn3XtMQh3fHiaDaZmEg4bEQS72kQB/kxVP SGS5KPw51o6iyrUQsE+L9PTc7LM8jaY= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1727734347; x=1759270347; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=WnHMq8BNhME2EnXLEvjuvqDtcGOOpjFxIJHkgzLF8FI=; b=Lv6I4vqVkWVJ0BKl5JvVNj4i9moCaiCQ/JBQkKZRcxn91M/zwwQBvXEK fH4JWFMVA1fwgMJAJchptkk3K+rurEgvhqT99srtgqYJR0jY9v22NRGE9 bXo0PL6V3PjOXg3aTSNw8NVYv9Z5Ef0PgYBeASP8ofSbAWfsRKsi4yj9H qnExC2+4Mx51l2kgvfgDwJrqUk1OasGluQoHW0AnH7Jg6SJbtT/sZa0rc fSKDrH0at24M4hPXw7ITlu2GNlDW+7pGhZzTlBcSfchUeQnq2d7iYisPw CniuEdgNA+X/PbzFVKlkmrhiSvHQSJUACPnkn/USSfbUhp/ymn64Zzer8 g==; X-CSE-ConnectionGUID: pJNhU5abTq6RdqR22XuYkg== X-CSE-MsgGUID: sXNo5+t/QbWQvr3h8bjsiQ== X-IronPort-AV: E=McAfee;i="6700,10204,11211"; a="49368406" X-IronPort-AV: E=Sophos;i="6.11,166,1725346800"; d="scan'208";a="49368406" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Sep 2024 15:12:23 -0700 X-CSE-ConnectionGUID: fR3kETJWS8C5+ue4fQbuyQ== X-CSE-MsgGUID: BlgiosatShO/iBvRb3rvGw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,166,1725346800"; d="scan'208";a="77985575" Received: from jf5300-b11a338t.jf.intel.com ([10.242.51.6]) by fmviesa004.fm.intel.com with ESMTP; 30 Sep 2024 15:12:22 -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 v9 2/7] mm: zswap: Modify zswap_compress() to accept a page instead of a folio. Date: Mon, 30 Sep 2024 15:12:16 -0700 Message-Id: <20240930221221.6981-3-kanchana.p.sridhar@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20240930221221.6981-1-kanchana.p.sridhar@intel.com> References: <20240930221221.6981-1-kanchana.p.sridhar@intel.com> MIME-Version: 1.0 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 16CB12000B X-Stat-Signature: iree4x844k1nziphrxw4t37qjqyqayo9 X-Rspam-User: X-HE-Tag: 1727734345-154295 X-HE-Meta: U2FsdGVkX1/Vj5aFtBVD5iKOC/BeS0g5MuhF7X874V0xRABPJQdCygHXpLRLUg4F2Zeyovdyx+a7D9AodEHASLaebMCOKauwFO+XmJu0DdqZ9AD+Q5Tp1DipeUXBePvS7b1CpZBMzI01IL45yjL8Ch/l9dIyLSrfsscxNI/d6htCs0xfm1Qiq0/7ei2zTl+bhxEQF0FkjbxRfrQoSPR8NyGZAjAXPETpd0T9H++HqZ/Ah/ymuYTGkJwqG5LLkxsGPTzLJuakraqVv6H0vMhhnhmypTNJzZ3o+PZn04eGVZi+3b/q5e3eK6TEDQS6jLb84Vd5Ao9K3o/PSqKzNA9z1I3Whsm8cIo9aAt4+r0gsU76hBJrZV2Uz54bIpShhmGwkPTCGz2XhNe3WuCeGUx2XhA8vU+KKKqYjO1qB1OoeA3q/J5ZgBUSMMgX/xWVGeE483guv0bwHtOkR0zou0ICKygkEFZ2Ysi8g9aGawTtLof0PBGzAosT0l/moJ10BL5vTi06kTDjk5spt28h05swLUN5mZsGECdW20Ksau/XKv7axT8cJcNYUa7Xjm8eWfhXe/nVcyWUyPRRlpfg7KCDfhN5gisJe8+H/fXqSRPOZWmBxDi1YexYVq9+ZKiFel8LUTb6aY1EDx312gBPJxsuo5hMdAk3w3odHJhyUFSXMsN0rWTyFV+IbOTadx06Azp+oZj0SYnh6kpjYe95fXYoQZhBNIYuUDYipJit1kjZoAa/8mVTUYOXjvzXLAPPyALMB/u7xyZYWR5GUNfqH3KJA+LPRXRGumwd8fZkDeWYkxT0C6DX81iLO5wjcA6duQepyviXKtLW/LM/xiZ8lDAFRQqqugkD2ZqqffBUrwzvcd5qTWRQOcFsniz/6P1ZSNWPSdp3D6N1+3XBYtHmVM0UDMRqgxbsstWfpWRWEUNhQv1DxK7ZqSFZkfKEECLpM/to7RkeY6rmHV+um/F0xUl w8zswxr1 /p6byABMbsLIKmwcCbW8Q6xpne6JZAKHfUTRuodxa/Dj9c6L8pzDBXKN0eyWmoTe28kUAo8JJ0m6TuteELDevMKIbI8YRNv3Sm9WPNF3hsqpLGnn9q7yEL2frAp6Tu2+QaAWMt3lSjlMoFy5crVFAklSPZ/xkW8WATLMA7h51UZRK3Jf6HUcjjJOcIncclELCPQtIAygb703TtGV/T1txbKOm0NQS6Co4gCYIO+Ag90+p0g3gDypym6TZIxnZIKZexNpm5Uy4t7bK8pdL3ntnKBTrXBhy5VjtWq2N6Ji3aIXcAJHTuvCDbiyabO19b4qpkS3BAt87A1sBm3KtBlm+XbuDGA== 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;