From patchwork Fri Aug 16 05:48:02 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: 13765454 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 5F19EC531DC for ; Fri, 16 Aug 2024 05:48:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E14EB8D004A; Fri, 16 Aug 2024 01:48:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D9C778D002B; Fri, 16 Aug 2024 01:48:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C16798D004A; Fri, 16 Aug 2024 01:48:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id A318C8D002B for ; Fri, 16 Aug 2024 01:48:12 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 4A33BA18F3 for ; Fri, 16 Aug 2024 05:48:12 +0000 (UTC) X-FDA: 82457028024.04.3C7415D Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) by imf22.hostedemail.com (Postfix) with ESMTP id 31362C0015 for ; Fri, 16 Aug 2024 05:48:08 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=nVztWFNH; spf=pass (imf22.hostedemail.com: domain of kanchana.p.sridhar@intel.com designates 198.175.65.11 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=1723787253; a=rsa-sha256; cv=none; b=w2F7dcCANofERjMAyamAxx2pan3oHhetgn5JdnRTEvCUmOrHb+q9CH2Raqg/1uWK4MMNmn n8h8kdH5NLWRwSYIjLQRlQgOWUac0M1Yn0QAItFHJMhqX0wtTR5vykf2c5XEdZfpXi1/aj NfcOkbt8TB8ap0ZYWV+N1WLH7QK0ZYA= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=nVztWFNH; spf=pass (imf22.hostedemail.com: domain of kanchana.p.sridhar@intel.com designates 198.175.65.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=1723787253; 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=naruCmolxM1VTIhLrUrisUJHcgVK8pYYLgjjkbmUCc0=; b=0foX0RNTPefar2fT9cS84o+4kJ/PiyGucw2sYjAd2/n8UfsbxJveFS7nw32meIYaMLUPYy nIu5UaMPVRMUs8ISHEmhm27OiCZ7Vz6Yx0GWR1n1ftIei/2Zo1T3jd/7+Yw69ZjBhpGC7y BZwr6GFLgMtTYOF35xhnUhavRVvT7Fc= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1723787289; x=1755323289; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8aJTLnzMPmjHtUmt/CSvhY9AKnZREM8rFjycd3MYym0=; b=nVztWFNHcL/Kg/+KiTHCbifsGxqY8QtDNC31vzPaSvZUSpZtiPHdDNSO upTXzV9iTprH9lmaaVnBJ/37AipSVnMBIbW4A2X4FXcYLMkDHOoyfLVRu uPY2IZ9CdjmpfR2nHMUlvB5Y55u1QibxMhnrBUIjMxEW3nsuLLboGs6Gj lZtcf+HSPmMyvEUzjOTX0v3SKVYcGp6yTMsLBW7GnmQ6/00nBPj7v85zM WOZ5O7BuFR2Vc9br0EtXGRJ3TCa48XMDiIwU3+bcPxYUXZtu9DUEhsUDz tP7B1K3MpnmlS5z+FR/UpUjC94NYCsoZz2w2CDvuEKDM0ohRJ2tj36qGf A==; X-CSE-ConnectionGUID: 8Ca4U244TYWOekdqu9w6Mg== X-CSE-MsgGUID: xCuVg4P/QC+WNQaYfw4OUQ== X-IronPort-AV: E=McAfee;i="6700,10204,11165"; a="32648115" X-IronPort-AV: E=Sophos;i="6.10,150,1719903600"; d="scan'208";a="32648115" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Aug 2024 22:48:07 -0700 X-CSE-ConnectionGUID: CmHiJCcuQdavnb7D8MPHOQ== X-CSE-MsgGUID: 39CNgtIxREOwdGxpX5wumw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,150,1719903600"; d="scan'208";a="59415332" Received: from jf5300-b11a338t.jf.intel.com ([10.242.51.6]) by orviesa010.jf.intel.com with ESMTP; 15 Aug 2024 22:48:06 -0700 From: Kanchana P Sridhar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org, hannes@cmpxchg.org, yosryahmed@google.com, nphamcs@gmail.com, 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 v2 1/4] mm: zswap: zswap_is_folio_same_filled() takes an index in the folio. Date: Thu, 15 Aug 2024 22:48:02 -0700 Message-Id: <20240816054805.5201-2-kanchana.p.sridhar@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20240816054805.5201-1-kanchana.p.sridhar@intel.com> References: <20240816054805.5201-1-kanchana.p.sridhar@intel.com> MIME-Version: 1.0 X-Stat-Signature: tbtps53dby9pt7k9x5nqg8oj4ebx5yki X-Rspamd-Queue-Id: 31362C0015 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1723787288-746188 X-HE-Meta: U2FsdGVkX18niiUgeyfCoZOuLLWtVJrIT6gdGFrNa5XLdmx68Rd3KjH/B6LsConde4KC/cC7Yxf79JUOellHwrGYYBbYfWe7k8tqTY59rParC1XSWdrPjAWrhqbDR4BWED9bEOkis8DT3uaAeyS0Jcj5iy8YiJ7Kgp5twfK3fRb7jMEniiSgLP9DXqRqOhZcBGcKAk44P5gdwSoHBMPuvQhS2ryJOpPB9WPTF9GCIjp8K9loV1c8UmTRDlIi1uxj3WwX9bH6cemEMTzteTQ9KPFYtFChq80oXNkHcaHS0JSbZhjP7dNpTJ512GuadA8fRmI8brGGgRbiOCmmnIBKDJ+tPQKQCUOeGd6JBxZWryl6hvGX1Nsad451iJIXnIQvVj2HGCiIeBWXEFDUA3c8t15Vl0HwqZY1005C2rHWpYJgwE+Sz3YFym0pO6Vmt2t9AukxWFKSu8WtYR6TeVQphAxyomK7oyqlw+2cdbEjNTBgGysoCPflFHr8v+lF7fBk4JROAxcAuUiiT9gxOzGCr/tJlqM63lC+ItrtmBkZXlxcU1MXOnw2HhWd+xnfct+ueYBSCnl/cNZaIulfnnA3iNJcSwS90N4ueLHQ0xNnk/geQFkSasI3Q2PYBp06s7iLYdMvp2qFcR5a5tQiW9T4TnDXvG+LauFHkUoc4a6XfqEHTvqUoxUF6SehIgo1wfK4iyDJ+kDxT1D1d0nmze8YKr8xXM2gMzRzpMqSVaaCQ4gX6QN6IkE5cIwyHnVjy3aJ1B0mfBA5sl4EtjSDYej8uIzYis8z2qthPv1Eu3GLJ2ccuwC99/mhC5JlK2Vrus+1YCUV9hrZFJ0GjWAu1micaozjPWDmKIIu/RfeAAj9T7cHqZnsS96mSb5SbD8w+Cgh1BgGdVpAtW0IVKaJcxa9PioLa7CL/yWqWm74ak5s7ViewiTuc4ERdYa3qJloCclxFeRGBRtX/s9TxtyxHdt oEAPy5kT RlOkW9T2xgafa+sc92JqNeFQmtzQHqA1hgQUoJC8kJfrEfvt1fQDpavXrwTt8hS/PPE7R5yoM1VASPvh5b4zLJLBbPtwg6OnJshuxm1oC8V3yecxfmPb97eyWun+8PFJjSDTLPmkOnQ9EmhYFo+vZzJYr73DRHM8DDQfb0caFns6X92aSJoLqc02qm6ZkNh7zcUNpM7BORzYWoXg= 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: This change is being made so that zswap_store can process mTHP folios. Modified zswap_is_folio_same_filled() to work for any-order folios, by accepting an additional "index" parameter to arrive at the page within the folio to run the same-filled page check. Signed-off-by: Kanchana P Sridhar --- mm/zswap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/zswap.c b/mm/zswap.c index adeaf9c97fde..6c5c656ec282 100644 --- a/mm/zswap.c +++ b/mm/zswap.c @@ -1358,14 +1358,14 @@ static void shrink_worker(struct work_struct *w) /********************************* * same-filled functions **********************************/ -static bool zswap_is_folio_same_filled(struct folio *folio, unsigned long *value) +static bool zswap_is_folio_same_filled(struct folio *folio, long index, unsigned long *value) { unsigned long *data; unsigned long val; unsigned int pos, last_pos = PAGE_SIZE / sizeof(*data) - 1; bool ret = false; - data = kmap_local_folio(folio, 0); + data = kmap_local_folio(folio, index * PAGE_SIZE); val = data[0]; if (val != data[last_pos]) @@ -1435,7 +1435,7 @@ bool zswap_store(struct folio *folio) goto reject; } - if (zswap_is_folio_same_filled(folio, &value)) { + if (zswap_is_folio_same_filled(folio, 0, &value)) { entry->length = 0; entry->value = value; atomic_inc(&zswap_same_filled_pages);