From patchwork Fri Jul 12 02:44:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 13731251 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 BCC06C3DA45 for ; Fri, 12 Jul 2024 02:45:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9BE416B008A; Thu, 11 Jul 2024 22:45:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 96E596B0099; Thu, 11 Jul 2024 22:45:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 835466B009A; Thu, 11 Jul 2024 22:45:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 67C5C6B008A for ; Thu, 11 Jul 2024 22:45:10 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 07515A0572 for ; Fri, 12 Jul 2024 02:45:10 +0000 (UTC) X-FDA: 82329558780.20.2E2A5B9 Received: from fout6-smtp.messagingengine.com (fout6-smtp.messagingengine.com [103.168.172.149]) by imf28.hostedemail.com (Postfix) with ESMTP id 07817C0006 for ; Fri, 12 Jul 2024 02:45:07 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=sent.com header.s=fm2 header.b=lz8yYnWl; dkim=pass header.d=messagingengine.com header.s=fm2 header.b="F 1B8jHJ"; spf=pass (imf28.hostedemail.com: domain of zi.yan@sent.com designates 103.168.172.149 as permitted sender) smtp.mailfrom=zi.yan@sent.com; dmarc=pass (policy=none) header.from=sent.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1720752291; h=from:from:sender:reply-to: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=jNGroiyo4BuTb3hCWpWux7PfCpk0jLOtvpYsdbCWP/I=; b=BDMDF2pPM4HXwb5MtXqGyFPR6IVQXHlxPkcgUBoA8VlooyW/wdcF3qPQ7VeXclGR3HPZpj +PZLdbcvNuqsL8/3GH8Kp1nyDF7pLF4uXMPNV9k6aSjuiGxs2f3V4uBHCCiGyv5xkdZGCX +1RyVM+swcH4Xz2Ob3Q6PLEK0jfIwlw= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=sent.com header.s=fm2 header.b=lz8yYnWl; dkim=pass header.d=messagingengine.com header.s=fm2 header.b="F 1B8jHJ"; spf=pass (imf28.hostedemail.com: domain of zi.yan@sent.com designates 103.168.172.149 as permitted sender) smtp.mailfrom=zi.yan@sent.com; dmarc=pass (policy=none) header.from=sent.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1720752291; a=rsa-sha256; cv=none; b=cokbUiaCFn9Ju/sdc8Xnbx6R1q/gBhVPo5bcs9JZUJPVncSCaYUEHB4Iv1Hq7ifii5UWm/ muuDtqfS13bmMqnTBh8ZJ+eINak067HahQ2xmFr5wldTMqYsE8sS2fnZodS/yoyHbQHrCg b4WaF0Th8yZXqZL1bg0ygNbJYLM2hCE= Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailfout.nyi.internal (Postfix) with ESMTP id 5CDE01388638; Thu, 11 Jul 2024 22:45:07 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 11 Jul 2024 22:45:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sent.com; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:reply-to:subject:subject:to:to; s=fm2; t=1720752307; x=1720838707; bh=jNGroiyo4BuTb3hCWpWux7PfCpk0jLOtvpYsdbCWP/I=; b= lz8yYnWlO09wfHb83ln8BKkBoq5gRUQUwFV6dKkRSNHwT4rFIM9zWzLIqahj4zcY nIKYIY0qBuykHnAcw9kWMVsgUcfpGapKaEEYwFcjePBPb9J+vOKMqVWSuhQdCUgi X/ywcj41J/8GmeqbecKCObHP2Gl3Zr1ZqExtA96VyEde9CU/pdggiB24rp7Ynkr3 KmvsfUc7zb0dwxGPPC5RGBYlTmzbvDgrDGjuoYWCIjKEyIi2CsDuZ8gZCHfRMDAy iA7+METH6x27l+qkdLRd79V01z1npc7+W91QR4PbAE2opafwTdtzGiAXOodyqxH/ P+RcVgx5iCn98RjXD2Wk8A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1720752307; x= 1720838707; bh=jNGroiyo4BuTb3hCWpWux7PfCpk0jLOtvpYsdbCWP/I=; b=F 1B8jHJ4ViBoTClRPWsQtEFz8ORDTWX/HBWUZXJMc/mK0/CscC9ecK2cnFdnms0Be Di/RSin7dfh9ANGM62MH/uM50t0aqSb1MHPuEYdPLltOQ15RQGlK0fnZVZGRt97l VE31CoxTR5wQr+uQojH/Oy1DWxLiiC80wUV7S7nzO3hbRu1IXbvqTq2JlXFJd5de aGcgLCth+TsO3jtZOGz0cqf/9IFDBzNrZP83iQ5jAddkb2UXrMHU0OurI1IE7twH t/zF5WbD9PIw2WTeQ2QEpLUvG8j901OJkltRg91Lsk1qggqlaE5i2tb4TNhXt3Ru ZojyNMaWjOD7ZZ300CnuQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrfeehgdeigecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffojghfrhgggfestdekredtredttdenucfhrhhomhepkghiucgj rghnuceoiihirdihrghnsehsvghnthdrtghomheqnecuggftrfgrthhtvghrnhepudfgfe elhfekiefgtedvudfghfduffefieefffejvefhlefhhffgkedtfeevhfevnecuvehluhhs thgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepiihirdihrghnsehsvg hnthdrtghomh X-ME-Proxy: Feedback-ID: iccd040f4:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 11 Jul 2024 22:45:05 -0400 (EDT) From: Zi Yan To: David Hildenbrand , "Huang, Ying" , linux-mm@kvack.org Cc: Zi Yan , Andrew Morton , Baolin Wang , linux-kernel@vger.kernel.org Subject: [RFC PATCH 1/3] memory tiering: read last_cpupid correctly in do_huge_pmd_numa_page() Date: Thu, 11 Jul 2024 22:44:53 -0400 Message-ID: <20240712024455.163543-2-zi.yan@sent.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240712024455.163543-1-zi.yan@sent.com> References: <20240712024455.163543-1-zi.yan@sent.com> Reply-To: Zi Yan MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 07817C0006 X-Stat-Signature: pfsjaswgqcp3n9qnrhd9moksn31mjrie X-HE-Tag: 1720752307-323765 X-HE-Meta: U2FsdGVkX19+IKf29bPwg74eyU+1eAYEc9aHWB7I60fnwHmdVhEh3AaLELcAvoU8fAYB3iWhVVswbr9ynibcxnt4Zt2Arv7WFfV7N4F3K985I2QHXY0ut1ZCUfaAM58COjA/VmCC7/soa1KT8nBXwDpR6px5k5cCGPx4sjz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4mHVL16xFHKQvhzUGnm/jkCX6rDSNF3Hl2Jp7+9ijNLdzlfOGxOjUym2UXDjCmreNjefKUmKU06wkP/ka1R3gtzPJVylf+/bMBV5FzCPrlUW8tcvP9y77Wx6e97Jb1KCVc9WqxuyhB8A+aepEiGLmtXbi6pC1zAer/dSBTAGt5SMe1ZK+2GyU= 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: From: Zi Yan last_cpupid is only available when memory tiering is off or the folio is in toptier node. Complete the check to read last_cpupid when it is available. Before the fix, the default last_cpupid will be used even if memory tiering mode is turned off at runtime instead of the actual value. This can prevent task_numa_fault() from getting right numa fault stats, but should not cause any crash. User might see performance changes after the fix. Fixes: 33024536bafd ("memory tiering: hot page selection with hint page fault latency") Signed-off-by: Zi Yan Reviewed-by: "Huang, Ying" Reviewed-by: Baolin Wang Reported-by: ... Acked-by: David Hildenbrand Reported-by: David Hildenbrand --- mm/huge_memory.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index d7c84480f1a4..07d9dde4ca33 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -1705,7 +1705,8 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf) * For memory tiering mode, cpupid of slow memory page is used * to record page access time. So use default value. */ - if (node_is_toptier(nid)) + if (!(sysctl_numa_balancing_mode & NUMA_BALANCING_MEMORY_TIERING) || + node_is_toptier(nid)) last_cpupid = folio_last_cpupid(folio); target_nid = numa_migrate_prep(folio, vmf, haddr, nid, &flags); if (target_nid == NUMA_NO_NODE)