From patchwork Fri Jan 10 12:21:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhijian Li (Fujitsu)" X-Patchwork-Id: 13934383 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 78231E77188 for ; Fri, 10 Jan 2025 12:20:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E4CD86B00AC; Fri, 10 Jan 2025 07:20:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DF97B6B00AE; Fri, 10 Jan 2025 07:20:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C741F6B00C6; Fri, 10 Jan 2025 07:20:50 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id A84116B00AC for ; Fri, 10 Jan 2025 07:20:50 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 3752A1A0A8B for ; Fri, 10 Jan 2025 12:20:50 +0000 (UTC) X-FDA: 82991451060.14.41FA89A Received: from esa3.hc1455-7.c3s2.iphmx.com (esa3.hc1455-7.c3s2.iphmx.com [207.54.90.49]) by imf20.hostedemail.com (Postfix) with ESMTP id B32151C000D for ; Fri, 10 Jan 2025 12:20:47 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=fujitsu.com header.s=fj2 header.b=gkndcfV4; dmarc=pass (policy=reject) header.from=fujitsu.com; spf=pass (imf20.hostedemail.com: domain of lizhijian@fujitsu.com designates 207.54.90.49 as permitted sender) smtp.mailfrom=lizhijian@fujitsu.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736511648; 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=RPUMw5V65PDuiZlZcwoqDcb1GLy3GPrsP7lNG7RKfSk=; b=2wlXdrHPkn0NOOnNzlSRLgBLgCI+fhSL6u+lyKbjd7MYIkfH/3rvV0XYPzOPTV+Ox6rtqT DRstg7GF/rC3iCBNYyoVT6+LarOkPYiBVK2zukPwT99q/OZbeDyhpod0AF4eoUFJbf3/27 hPHan/yeFkRIo/wtbilkVOtuudV4ntI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736511648; a=rsa-sha256; cv=none; b=yI/1QucXU8pfGdTCU07VLZw9ISW/BNDd5r0rD2zhLlgou8HQj8pOsA2/8dCPz5CI5mVrjV VyVLAt4LIa6bvkcT3SPFxAEISUFoVc1gZYqWxu7ccPKjpLqSC9xZOaG5QXrDB2+AqjKFaX cH3gpe6FKpugLiRSnkj9KGxKHmBLHMg= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=fujitsu.com header.s=fj2 header.b=gkndcfV4; dmarc=pass (policy=reject) header.from=fujitsu.com; spf=pass (imf20.hostedemail.com: domain of lizhijian@fujitsu.com designates 207.54.90.49 as permitted sender) smtp.mailfrom=lizhijian@fujitsu.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=fujitsu.com; i=@fujitsu.com; q=dns/txt; s=fj2; t=1736511648; x=1768047648; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=42VWKJ8YW8tK01MzcnsOlNA2rXxVY4ofFPTfpQxtj6k=; b=gkndcfV4INylIH6eOgu0snxmZbtXhWwwMInGtkjEBXBaRFYMu1cvv4Lk Z4QfP7+8ZpuX8uX5qLzC1Rti/gJ4CuNoZxA/UFPlVyUQhukDZuVkr50G+ 7Fy8yBsViWyYa9GYuNAGli2yzUPmcz/XvOLLTmePUqn4xv87gGh6XU5TQ kyiGzI7zGxRrgjnLmSMK4AaQmPr6ksy3liTME1IZzUZVMBOybTD2+WIHA wTaOZtjtsNALgrPghm1nIigFKfK/2fplFyhWjqstrdtECjwZXZnz4cVck BiAghFVgw26qPPpmSiWhCg7PvsqCTIF1SZzk9XA3QQ2+Lvb7EphDyyi9m A==; X-CSE-ConnectionGUID: d9GJRVkJTZG/oXA9eY3DvQ== X-CSE-MsgGUID: R+RDezYGR/SbwZrR0n9SVg== X-IronPort-AV: E=McAfee;i="6700,10204,11310"; a="186159827" X-IronPort-AV: E=Sophos;i="6.12,303,1728918000"; d="scan'208";a="186159827" Received: from unknown (HELO oym-r4.gw.nic.fujitsu.com) ([210.162.30.92]) by esa3.hc1455-7.c3s2.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jan 2025 21:20:46 +0900 Received: from oym-m1.gw.nic.fujitsu.com (oym-nat-oym-m1.gw.nic.fujitsu.com [192.168.87.58]) by oym-r4.gw.nic.fujitsu.com (Postfix) with ESMTP id E720BDBBCD for ; Fri, 10 Jan 2025 21:20:43 +0900 (JST) Received: from kws-ab3.gw.nic.fujitsu.com (kws-ab3.gw.nic.fujitsu.com [192.51.206.21]) by oym-m1.gw.nic.fujitsu.com (Postfix) with ESMTP id BB324D8C1A for ; Fri, 10 Jan 2025 21:20:43 +0900 (JST) Received: from edo.cn.fujitsu.com (edo.cn.fujitsu.com [10.167.33.5]) by kws-ab3.gw.nic.fujitsu.com (Postfix) with ESMTP id 5113C202ED365 for ; Fri, 10 Jan 2025 21:20:43 +0900 (JST) Received: from iaas-rdma.. (unknown [10.167.135.44]) by edo.cn.fujitsu.com (Postfix) with ESMTP id BF7211A0071; Fri, 10 Jan 2025 20:20:42 +0800 (CST) From: Li Zhijian To: linux-mm@kvack.org Cc: Kaiyang Zhao , Andrew Morton , linux-kernel@vger.kernel.org, Li Zhijian Subject: [PATCH 2/2] mm/vmscan: Fix pgdemote_* accounting with lru_gen_enabled Date: Fri, 10 Jan 2025 20:21:33 +0800 Message-ID: <20250110122133.423481-2-lizhijian@fujitsu.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20250110122133.423481-1-lizhijian@fujitsu.com> References: <20250110122133.423481-1-lizhijian@fujitsu.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSS-9.1.0.1417-9.0.0.1002-28914.007 X-TM-AS-User-Approved-Sender: Yes X-TMASE-Version: IMSS-9.1.0.1417-9.0.1002-28914.007 X-TMASE-Result: 10--7.632800-10.000000 X-TMASE-MatchedRID: llTo18AJfvH6C0RbcP9ApuMobH1h01ziY0r1N89tnQ7+Aw16GgqpOwSj wbzZYG9H1z8hM2rU8FCNtBPawAHW6IadzrWEfJJMVfLHMdWDkKgbbhhV65kaY8C5DTEMxpeQfiq 1gj2xET8qqtDuUtwyfLk3IyGZuuaD7xCWOo2+4bpwUSK4/EeOxVj54yQX4WAWt7nV+Ecc5FGjxY yRBa/qJXcsDK2xBHh7jaPj0W1qn0Q7AFczfjr/7JtAPn6huqqAqAMzFABxg/wqBYgQWxz9MOQui Ul2wtkbXZbe9jv1Xao= X-TMASE-SNAP-Result: 1.821001.0001-0-1-22:0,33:0,34:0-0 X-Stat-Signature: dkpaxjmt7qnbqo7fcf9j877fp5gz145z X-Rspamd-Queue-Id: B32151C000D X-Rspam-User: X-Rspamd-Server: rspam01 X-HE-Tag: 1736511647-648335 X-HE-Meta: U2FsdGVkX1+VEwo+phfM2HpLi45HWllB/70O0lnhHtCCJd43YxfcAIFkk/sjqaGg+d2hSZlfH2CdNZM88W0Zdjh+ucMuvr6tnJneXW6mQOUnoC+3Mr/95LVSBtr9DnR8kUwgJd7BjoDmDmftfYtIScEdsssiRl33Ja0JtHoE6Tt6klv1tRT3NYnpd3wA5xhDLQwE7unLrEiiWoluwwEpnwpmvG9NEzZ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osity: 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: Commit f77f0c751478 ("mm,memcg: provide per-cgroup counters for NUMA balancing operations") moved the accounting of PGDEMOTE_* statistics to shrink_inactive_list(). However, shrink_inactive_list() is not called when lrugen_enabled is true, leading to incorrect demotion statistics despite actual demotion events occurring. Add the PGDEMOTE_* accounting in evict_folios(), ensuring that demotion statistics are correctly updated regardless of the lru_gen_enabled state. This fix is crucial for systems that rely on accurate NUMA balancing metrics for performance tuning and resource management. Fixes: f77f0c751478 ("mm,memcg: provide per-cgroup counters for NUMA balancing operations") Signed-off-by: Li Zhijian --- mm/vmscan.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/vmscan.c b/mm/vmscan.c index 430d580e37dd..f2d279de06c4 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -4642,6 +4642,8 @@ static int evict_folios(struct lruvec *lruvec, struct scan_control *sc, int swap reset_batch_size(walk); } + __mod_lruvec_state(lruvec, PGDEMOTE_KSWAPD + reclaimer_offset(), + stat.nr_demoted); item = PGSTEAL_KSWAPD + reclaimer_offset(); if (!cgroup_reclaim(sc)) __count_vm_events(item, reclaimed);