From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from esa3.hc1455-7.c3s2.iphmx.com (esa3.hc1455-7.c3s2.iphmx.com [207.54.90.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7CB2D20C037 for ; Fri, 10 Jan 2025 12:21:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=207.54.90.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736511720; cv=none; b=YhFiLGm9oioSZM14Q2pyhH3yPzyuWHN06wN1ZmgeeiNgYbnHvLIECWAzq95WBKmETVOHP3X6hqBaTyKHXTY0DFYv8FnazUMPH/gLl+90qyDiOviEfGEFlndbdLDQWB1KT3bKBi7vJG7Uygflr1aFJoDPlOc7n4jGEuDqrVzUFGk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736511720; c=relaxed/simple; bh=42VWKJ8YW8tK01MzcnsOlNA2rXxVY4ofFPTfpQxtj6k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Q59Qz9Ges1IzpaiutdxFZoi01VlNSB5Ua8o6cYkaz6Qo+gDoziV7lLIxWjHL+FeHEPMFIrGQRw/WgsX6Ps1WVvkLJEQTnGIrppQL867oIZkPVLWHu3KI2/nGVqrEfwEjidOFN9/Fo0lEqJ8gGx3lqpXuI3t768dZTPwRrWRzHBU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fujitsu.com; spf=pass smtp.mailfrom=fujitsu.com; dkim=pass (2048-bit key) header.d=fujitsu.com header.i=@fujitsu.com header.b=RO7TfLF4; arc=none smtp.client-ip=207.54.90.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fujitsu.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fujitsu.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fujitsu.com header.i=@fujitsu.com header.b="RO7TfLF4" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=fujitsu.com; i=@fujitsu.com; q=dns/txt; s=fj2; t=1736511718; x=1768047718; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=42VWKJ8YW8tK01MzcnsOlNA2rXxVY4ofFPTfpQxtj6k=; b=RO7TfLF4Le/5+AE19g9HvgQ1MyudeLpUXFv0epMzHfZT2pjOr3FTaVUo Chsuh0LufNztIjOzKUE58aSsXZo5MzRxcpIYgycBUKW4cLszgISl98mu2 1/bpuVwOSnvtMvTGOWvuzkntEOLfdS24u8uzHobhTcbxw5WahJbS/oHvB OT6GDhZDGC8uwQ2tCZjFk3qIdg2aCfcFL67xYoJcsMK5moQySYNEh7TPe HE/7TMUGy0TzLk2+9H5p1SjkZ4URpuXWjhllrNHJ3bQnN69yhC6YEVbyX GLFtyQzRBD2T8hOqb3koVy5Jgnw9vBzmMdbD3OW6KODaeNd6SWtHffYWC g==; X-CSE-ConnectionGUID: s4OZK+l3Q62+MrtkxxLMaw== X-CSE-MsgGUID: SM4HOfJKTuCo2mQLLJoOfg== X-IronPort-AV: E=McAfee;i="6700,10204,11310"; a="186159829" X-IronPort-AV: E=Sophos;i="6.12,303,1728918000"; d="scan'208";a="186159829" Received: from unknown (HELO yto-r3.gw.nic.fujitsu.com) ([218.44.52.219]) by esa3.hc1455-7.c3s2.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jan 2025 21:20:46 +0900 Received: from yto-m2.gw.nic.fujitsu.com (yto-nat-yto-m2.gw.nic.fujitsu.com [192.168.83.65]) by yto-r3.gw.nic.fujitsu.com (Postfix) with ESMTP id E9A41C3F9A 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 yto-m2.gw.nic.fujitsu.com (Postfix) with ESMTP id BE512D5101 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 544DB202ED369 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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); -- 2.44.0