From patchwork Thu Jan 9 06:05:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Donet Tom X-Patchwork-Id: 13932083 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 B9211E77197 for ; Thu, 9 Jan 2025 06:05:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DB7056B0085; Thu, 9 Jan 2025 01:05:57 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D667B6B0092; Thu, 9 Jan 2025 01:05:57 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C06BE6B0093; Thu, 9 Jan 2025 01:05:57 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id A12EE6B0085 for ; Thu, 9 Jan 2025 01:05:57 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 5411F1A1742 for ; Thu, 9 Jan 2025 06:05:57 +0000 (UTC) X-FDA: 82986877554.02.D632244 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf05.hostedemail.com (Postfix) with ESMTP id 15E9C100007 for ; Thu, 9 Jan 2025 06:05:54 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=SiFII05c; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf05.hostedemail.com: domain of donettom@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=donettom@linux.ibm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736402755; a=rsa-sha256; cv=none; b=AI9Unsc74wRHM4+oeCDKPVknEtuuD+BQp8056cte+t9un3aGm6ceS5i+Dim8ETmFUDYXac jSmeDiqCKRuS6YZH1wY2fBl9bEN8j8CK5bV4DKRYQ5qoZHiTA6gDCCvhsbY/QTnFefh0zF RRwfiWfsc7nfUHuUpgaeR3oTXzLZzKc= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=SiFII05c; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf05.hostedemail.com: domain of donettom@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=donettom@linux.ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736402755; 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:references:dkim-signature; bh=kLYplT+Wxoi+Aw/PD4w5qJjloO9coYWxkPXndEuEAAY=; b=mtiMAt3HUY3d00/OEAPpieikkh128CBu/ZQAxjleMS17tGjsgZnqjdIPPtmGVDkoSAfWVi ggxAhZDM3zTWvloq+Oj4jeM57c/12EmBD2Tl4aTfwnOFigGpRjhU2EAP6C8CU7GcMZkeor Lh9f/pj7HMOTzpAAKbKN33aINxBj3j4= Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5093r6Tw020178; Thu, 9 Jan 2025 06:05:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:message-id:mime-version :subject:to; s=pp1; bh=kLYplT+Wxoi+Aw/PD4w5qJjloO9coYWxkPXndEuEA AY=; b=SiFII05cB1sAO5IE7aGmJTM+jPDkcOUJq1T1ad1SXQX9Y4udoT/LSZguK t/jKmiEGAo5ZUjMUASZ2mCTikpu9AKCxJXu47itcaq+QfR7Czka07MLE2h8JgRYH ld0IRi2x2fsW0JuXarY8AGEgEn+3p74q66f27sm7bU5KG4nrq+0dPrrvIAER09X4 NlyHe3PXW7MTO1dAlI9kMi25VS/zPwWhA5KeU7MWQU4SzFtmWLXJB5kw7ACaISUN 4EsNdLSbE0nbpRFCZ5ilAtwMTr3rulCdMM7tbS1WaWFpL9SEmWUJdv7i9f1P4SfN 1ubldmhHEJlvaeMJnKxUMUylPH38w== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4426xqrf4q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 09 Jan 2025 06:05:47 +0000 (GMT) Received: from m0356517.ppops.net (m0356517.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 509606eO017458; Thu, 9 Jan 2025 06:05:47 GMT Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4426xqrf4g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 09 Jan 2025 06:05:46 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 5093r86o008870; Thu, 9 Jan 2025 06:05:45 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 43yfq03uxx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 09 Jan 2025 06:05:45 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 50965h1219595764 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Jan 2025 06:05:43 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7C34420043; Thu, 9 Jan 2025 06:05:43 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 021C72004D; Thu, 9 Jan 2025 06:05:41 +0000 (GMT) Received: from ltczz402-lp1.aus.stglabs.ibm.com (unknown [9.40.194.31]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 9 Jan 2025 06:05:40 +0000 (GMT) From: Donet Tom To: Andrew Morton , Kaiyang Zhao , linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Ritesh Harjani , "Aneesh Kumar K . V" , David Rientjes , Johannes Weiner , Yu Zhao , Michal Hocko , Muchun Song , Roman Gushchin , Shakeel Butt , Wei Xu Subject: [PATCH] mm: vmscan : pgdemote vmstat is not getting updated when MGLRU is enabled. Date: Thu, 9 Jan 2025 00:05:39 -0600 Message-ID: <20250109060540.451261-1-donettom@linux.ibm.com> X-Mailer: git-send-email 2.43.5 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 52CNxQSqIVMVM4X3EScCufYqiZIDLH2z X-Proofpoint-ORIG-GUID: l7ONNhwAhIzmVrV9ni5wcktv8vZ3Wvby X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-15_01,2024-10-11_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 mlxscore=0 suspectscore=0 phishscore=0 spamscore=0 bulkscore=0 mlxlogscore=999 lowpriorityscore=0 clxscore=1011 malwarescore=0 adultscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2501090047 X-Stat-Signature: sig6b9xdze3diupwkhuzdh5q7hanoeth X-Rspam-User: X-Rspamd-Queue-Id: 15E9C100007 X-Rspamd-Server: rspam08 X-HE-Tag: 1736402754-761454 X-HE-Meta: U2FsdGVkX19MgPy8BRcmsHHfhTBCFc5hvjEXSNjRuwPa8AshM7TcgS8VbdeU50nRU40NnczlCJa0lPdEN4p2gKRNQgc1DHrA4pgXjm8Gy7VZlvuKZppLSys341dGZTaxcpE02zAIKFMj6/rm5MK2O1S1vsG1Jesq3SO2qI0sQTMz8B42Nb3aZS+LcWLvUmvMpIMKtUsdWXR2l5lsmp4orGguUjsdSKGIa0MfqKVdTMpicpYkADKy2lFbIrvg4/RdpTIr29V0N0AKug1uL92DyoxgJlU6ipPL5V4MyIxaIm/jkEc6uWPfupNyqbL3xRhOb8Vd1LnXevINl4WGnp54sVdWNUxwb76TM0CcGS5Vo1BgxRkySeEs991fAuwEFXLVdvQc7pEpZAOLbwz4AJrA2aLHQW7+JRa7lLxbaG7shgMs3dqJ0pmk5/HLbn8bZcxAg6X7HFUlQcfyXttiTXrbFuHZDSif8FQHaGr19rEhaxvEPLqHvOdoneehwhfgxD/imTwfRdrAlCPoFmV3rt71NTwnmHdojbvMNzRRZC2IVVKkup37OcUjUdPduk64nqKJwq5qlwxTTMAfX0Ue9CqnRX7qD1bLrgbdbAlj8WiRivgR/sXBhWGoqDjvRszwMBSiwzIKG9rf3jDK14W6xHDEDy06tEg1wOAbGLdAtkeoWF8W27Z/rMi+CksbezsgZfLkKxG8K+8UGBt2aiXC+srmbzCVgNuXSx8WwExjR5WLGS4SaIpvtQp+PjNUCaGOm7uaVlXeLfLV6DdAICsUKpXluszxbgv55tRkfdW1a30VCkoTcRdCaz+oXMb5LO4iItovtXaw4XJe69hzu7ouhn5EWsNaESEJO5TlHAQgI+Puwun4z/2QvbR+mVKvQTkCN9ZlW/q/Jof27sZSnfkDZi/P6j4+yEFwirFqJIxqW02EmZKmjPI1xBrEck2VjJYrSD6JqmIGxX8qj8p0JRJnqhm +S4QNt1B +wwJEoTyWJ6BkhnNbrzbqZUrqHGVqUL5TFm8HWKjUDycHPeEBJ8fFpr+yD0nYYVNp4cLv6lyFqstcJzw1TGq/nxfI268G9R3ZJUWEMZE5VdGXWpejtFz/3vPhGjXTjLzd6lVS+e8EogETXSlZYAEROPPcrE1AY6U+jV9ngnQk91jUAlvPrQDgT3UNSBRRB07sfjbAlZCmQhFW6jS+JDfmgJRp/DzeJPsMpu1J9gWH3J+u0ptzUdhiLf0YQdTawWeDFeT07Db4bdX+Yl5nXjaZJtfARg== 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: When MGLRU is enabled, the pgdemote_kswapd, pgdemote_direct, and pgdemote_khugepaged stats in vmstat are not being updated. 'Commit f77f0c751478 ("mm,memcg: provide per-cgroup counters for NUMA balancing operations")' moved the pgdemote vmstat update from demote_folio_list() to shrink_inactive_list(), which is in the normal LRU path. As a result, the pgdemote stats are updated correctly for the normal LRU but not for MGLRU. To address this, we have added the pgdemote stat update in the evict_folios() function, which is in the MGLRU path. With this patch, the pgdemote stats will now be updated correctly when MGLRU is enabled. Without this patch vmstat output when MGLRU is enabled ====================================================== pgdemote_kswapd 0 pgdemote_direct 0 pgdemote_khugepaged 0 With this patch vmstat output when MGLRU is enabled =================================================== pgdemote_kswapd 43234 pgdemote_direct 4691 pgdemote_khugepaged 0 Fixes: f77f0c751478 ("mm,memcg: provide per-cgroup counters for NUMA balancing operations") Signed-off-by: Donet Tom Acked-by: Yu Zhao --- mm/vmscan.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mm/vmscan.c b/mm/vmscan.c index 9a859b7d18d7..b1ec5ece067e 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -4642,6 +4642,9 @@ 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);