From patchwork Wed Aug 14 06:28:27 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: 13762877 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 6109EC52D7F for ; Wed, 14 Aug 2024 06:28:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4F06C6B0088; Wed, 14 Aug 2024 02:28:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 452EF6B0089; Wed, 14 Aug 2024 02:28:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2CCA06B008A; Wed, 14 Aug 2024 02:28:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 07A0F6B0088 for ; Wed, 14 Aug 2024 02:28:41 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id A5F4DA75DA for ; Wed, 14 Aug 2024 06:28:40 +0000 (UTC) X-FDA: 82449872400.09.4114BC5 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by imf18.hostedemail.com (Postfix) with ESMTP id 8B7AD1C000F for ; Wed, 14 Aug 2024 06:28:38 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=OLGTYPNE; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf18.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=1723616865; a=rsa-sha256; cv=none; b=Ygt0Nbmk9MOi6N9AWUqlBcrzoB/4KdX3SUVGaj6AmTJ7iprwnDNdwnzVmLXpuqGhmkKfPf Yrcz08IczSr+4jyuS1G6TKlncj70UZloHteNkoUZZ1krk10xhHYW3GbVYHY0Rhqqs04kjW OwCntp9wZMEL43kvJHxPqMzetezucjY= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=OLGTYPNE; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf18.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=1723616865; 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=nSeAi+6uplwjZyxeomo8uEiWzUJl3sO34C/KGjO3TVk=; b=G6onuN2ZFd0p+TMn82FlrzIXlkEWy3k28JByxweDUAEEDl9izo1EaSaOmTdX9OdohZVj0n i7s9AiR0JvOzx2rtfJ4yjCXD1QBi3oVGsJm4oUs8YFw+mxJqRQEFj1W/joHWhKcSJMzLBS uuS5P6oviXjhlhX2L7pV0kGRFusR5uQ= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1723616919; x=1755152919; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=oe1u+d7vabSLdycsD7ncPotAgciyDo4K/Y5B+/jbgp0=; b=OLGTYPNENVVLG+Ipz+AiO8VSNS7lASWiXuLgQgzISjELernYSBx5fFJp q+oN9qThXazBuKL+uPkRgIBTGGM4OCS9PZ2QSAAbMbjkF2aKDXbExSiz9 wqvjvK3lbgTHKkaGj/j0MeBG0wS6hk5WkmVHIAErQGN6T6+drw4erMytk TRbHyOE9VIqGSSOQYAuggyZ5NNo2qSbUA/oJujK9Mq4Wzd+9ymrdyivwN 6EdmN0YvDxQJjGUGgIE8gWEA6sqFtyOhbBMDFUAQPebrjL5UFGaEKExe/ Ioq8HThSCWZ8VjVxr30IRXgrkAeZmfo+UrIrJjomrEBlKbsRJtZZHXaUU g==; X-CSE-ConnectionGUID: 3gFAk32/QL6vXbXnVHeLmA== X-CSE-MsgGUID: pHn1iqR5ToqFwLHyEzYsqA== X-IronPort-AV: E=McAfee;i="6700,10204,11163"; a="44333006" X-IronPort-AV: E=Sophos;i="6.09,288,1716274800"; d="scan'208";a="44333006" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Aug 2024 23:28:33 -0700 X-CSE-ConnectionGUID: kzgamZ+BQ3SH8LR1nuZ/yg== X-CSE-MsgGUID: ClU524GxSxK+fXEp+PHjlw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,288,1716274800"; d="scan'208";a="63568749" Received: from jf5300-b11a338t.jf.intel.com ([10.242.51.6]) by fmviesa004.fm.intel.com with ESMTP; 13 Aug 2024 23:28:32 -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: [RFC PATCH v1 1/4] mm: zswap: zswap_is_folio_same_filled() takes an index in the folio. Date: Tue, 13 Aug 2024 23:28:27 -0700 Message-Id: <20240814062830.26833-2-kanchana.p.sridhar@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20240814062830.26833-1-kanchana.p.sridhar@intel.com> References: <20240814062830.26833-1-kanchana.p.sridhar@intel.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 8B7AD1C000F X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 69753yjbcd7yc96ke451kf4nc9m8iuxq X-HE-Tag: 1723616918-262381 X-HE-Meta: U2FsdGVkX1+HEh3ubaM3tQjEtcAcjIAzu2PjHs51DU7fop+jiDEwXAkS4wVk3WPbb/SCUmRYok7AkuYZryZJUPBefwSRHS3FNn5e8mvRTRn+U73xFLy/T+iV5djbvJLfD11iqiLVVqc4iObwBR3Skkz+wuqqDRyUwDEqM7vHOpSUu8vDilwEYl8hrp85KwO0p/RbDaTVZt0QnC881VbtPzKWWzp2pr19gmta26grbVOozGwLi3689CcXiJpqqcP9zbuCXXaafG2zRHqcnoLOhsM+F7eZsFEwNKxDWKDpY+I8WG1k+iFWdx8Q2raMjrjyBxpXGtlYv8bA1l4JUdbu9MENQSxVk8sbVAvA2ky80RbdXSxaJxJfeGX3h2ZA6HP6pMa7YJyg0SYNg55UES5xauymO1FY0h7qqVxuoM4w/xoCDIWxDcxAYZ6fV64gpFa4PQMk16S1TAo3msj/Q/j5wPTVVFYx+Gb2JyWUzwBJfF7+NgZj5Tdqpd+TYleLWX4ZOSWm1wgUfq+CGpzl5YLI+FY+9IvC5FkMFwtYHFqjJDNhGacYNAE2/T+CvEvD5tgs8Dl1EP+xC6WX1rkA0l4SzVBv/8oP1CNjAbXTZX5B4fcI31QXWKOr8iG0MWKZnQw434OVXHnDF2DSQUgph7vtHP8b0JUzxtdKi99dD07g3C4C2sav8qfynDWDOw1O+f2+AZWLSei6nYsM15ffwV7rW2XY8NTqlI1hTzdaLNVokEPhBrU1BhSBRPNFqlloM0Mp7SZwu4EIkaK794STw5zhwKU8S/qSxtwoe3W3VCCdUKwfstWMbLRh8sB6uy4PeAZKeid9OCf+6dkm9rWRU805qRSU0hs9SX64GYycV6W6h+oRL2mESMl8TmHVAoHklINwHP8Ds3HyVVLv/mjEbJ2F1+dMNK4Ehzpkklg9+qxui+r3961K02nWPgzMmGhRtk/xrw7BRO+fia3lFEZfz9Z eXnpV5HY Pu0avDpu/DxImDCiwOFA/V9vFd3wL6XUhYLKLohazTdo+nIVAUjLKRk4WSwyX/nJCvWYFBJUdtMHCbqOc8XHLqc6LGTyMkE4z6dZCaDbn+AOEouZi4Yh8SwM9+dJkw3mbTk5g0NXb3S6U3qTxgsTc6tz6VCpv9ATRGWNgEt+bg4LJejzVBZ3WYnHx5mBNk0YTR+3/swzsYouP+ow= 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 a50e2986cd2f..a6b0a7c636db 100644 --- a/mm/zswap.c +++ b/mm/zswap.c @@ -1373,14 +1373,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 *page; unsigned long val; unsigned int pos, last_pos = PAGE_SIZE / sizeof(*page) - 1; bool ret = false; - page = kmap_local_folio(folio, 0); + page = kmap_local_folio(folio, index * PAGE_SIZE); val = page[0]; if (val != page[last_pos]) @@ -1450,7 +1450,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);