From patchwork Fri Jan 10 12:21:32 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: 13934384 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 BC042E7719C for ; Fri, 10 Jan 2025 12:20:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1CE086B00C5; Fri, 10 Jan 2025 07:20:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 10AB76B00C7; Fri, 10 Jan 2025 07:20:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CC1656B00C5; Fri, 10 Jan 2025 07:20:50 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id B0E956B00AE for ; Fri, 10 Jan 2025 07:20:50 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 6E35F1A09F0 for ; Fri, 10 Jan 2025 12:20:50 +0000 (UTC) X-FDA: 82991451060.20.E046D98 Received: from esa12.hc1455-7.c3s2.iphmx.com (esa12.hc1455-7.c3s2.iphmx.com [139.138.37.100]) by imf13.hostedemail.com (Postfix) with ESMTP id 22EE220003 for ; Fri, 10 Jan 2025 12:20:47 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=fujitsu.com header.s=fj2 header.b=fVe76nNl; spf=pass (imf13.hostedemail.com: domain of lizhijian@fujitsu.com designates 139.138.37.100 as permitted sender) smtp.mailfrom=lizhijian@fujitsu.com; dmarc=pass (policy=reject) header.from=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:references:dkim-signature; bh=FuZFfiENKRgkY7jivRvtdfoZ7u5bptdDnuVAG8Vu8Kg=; b=747TqfMGw3UxUlEFU8MFv06X9wwPBEv5EHez0t2b4lXrfy6KB2pt3g53qQaD5LgklGv51c hmwbsaUTd4KppNFM2/NXLOPIYKbQz8gKgkWr0z5nIevC8rwums/BmU7QbHNOj5OPEh0GIL o40yrHsC8J/5BcGG48UMiFu/3HeetaU= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=fujitsu.com header.s=fj2 header.b=fVe76nNl; spf=pass (imf13.hostedemail.com: domain of lizhijian@fujitsu.com designates 139.138.37.100 as permitted sender) smtp.mailfrom=lizhijian@fujitsu.com; dmarc=pass (policy=reject) header.from=fujitsu.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736511648; a=rsa-sha256; cv=none; b=fXAeqNXI75ffR7b8/NSHW5+OLES+mO5WsfuZQBwyDhA/Vzb7lcduOHOJjWYiQGlfYIw52W uDAg6Ik3El5GJua52v7GGOvnngQMVgg46zJ6ZVHaEEVfU3gYe8w/H0hFum8rlrfWRI0KiQ brroKPH24iPQ3EFTaDOn4ebMMjpYiF0= 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:mime-version: content-transfer-encoding; bh=65r/qZPJes78kiIIXaRQZysNM1Xe6cntqmOLkf1614c=; b=fVe76nNlx2eQqEM5NVMoGHD7Mwig7WtGfLC53cVntd2KXCG6wTpAeZzI W4pNq4/4wh1drj+L9PAOqpt69rcXWyLOZKDzj2/L7nsplG6/qreoJ4duk MAGy3e/mgeWM+r9M4Ug3tseHhgojE5hnNFjOR1ksYoZw+eIMaGEmkFz8H XLqep5+S0Cc86uRSuE4HP0Hu7vDYnYll1a/u6JB6L8/v1VVU//RtiJT9w uklpBJed4pq/ie5YMoDONXrKODjICtx6TC40dw6WNGVk4HQzJl8NZjh2b PAXoNWhSfu2ANei1G03lWsFjujUDNqQkVVUR+v0wWycAtUBiDu1+K82qt A==; X-CSE-ConnectionGUID: 2rLa2X5pSymKHo05Zx3BlQ== X-CSE-MsgGUID: lkGmYMBUTzCnoKghX+Gv1A== X-IronPort-AV: E=McAfee;i="6700,10204,11310"; a="165128461" X-IronPort-AV: E=Sophos;i="6.12,303,1728918000"; d="scan'208";a="165128461" Received: from unknown (HELO yto-r4.gw.nic.fujitsu.com) ([218.44.52.220]) by esa12.hc1455-7.c3s2.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jan 2025 21:20:46 +0900 Received: from yto-m1.gw.nic.fujitsu.com (yto-nat-yto-m1.gw.nic.fujitsu.com [192.168.83.64]) by yto-r4.gw.nic.fujitsu.com (Postfix) with ESMTP id B5F1AE0765 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-m1.gw.nic.fujitsu.com (Postfix) with ESMTP id 8CF70D1980 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 1C5062022762A for ; Fri, 10 Jan 2025 21:20:42 +0900 (JST) Received: from iaas-rdma.. (unknown [10.167.135.44]) by edo.cn.fujitsu.com (Postfix) with ESMTP id 2670E1A000B; 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 1/2] mm/vmscan: Accumulate nr_demoted for accurate demotion statistics Date: Fri, 10 Jan 2025 20:21:32 +0800 Message-ID: <20250110122133.423481-1-lizhijian@fujitsu.com> X-Mailer: git-send-email 2.44.0 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.328400-10.000000 X-TMASE-MatchedRID: UpZ+EYxJ0vkM5CG8CYBPxaPbYx8mFyCIqf/efKFN1nCr1gUu9f1F/xzu L4P52bGMIvrftAIhWmLy9zcRSkKatXN94JK30y2IngIgpj8eDcBpkajQR5gb3mn0m688Eo38Kra uXd3MZDVwWSVyBlCcxxJo5B2/HUubMnVEloGvKtNuqigeLFHGpT2VMu9pSwVzr98/cAo+GMyY2/ fVgU35PnS6FqTvuDH1Jyi7ol44knmUTGVAhB5EbQ== X-TMASE-SNAP-Result: 1.821001.0001-0-1-22:0,33:0,34:0-0 X-Rspamd-Queue-Id: 22EE220003 X-Rspamd-Server: rspam12 X-Stat-Signature: xjsznxhqy56xery6849pie7yydqk86by X-Rspam-User: X-HE-Tag: 1736511647-151409 X-HE-Meta: U2FsdGVkX1/g4fnHGntkVOi5tuYZNf07BU35tcIfay/yI/NFYS7x8BTP4Tjvaqt2h6A2PgBxMefDlpJHvWCxMC9UnZ+mbzSKk3m6zUKs40pCgprJ+6/Q6FQ7sJQf4Qf9GvGxwVLXmh5gUDRwd1m6vUgOdWmF8kAriqseWzTtwharsPGBmVXnOD6pHt3C1ju3RqbGHWS8NWgy1T8KxONA2asfbU3Tgjzy3KSUP8S/HLWAFXHC/BrS2hPByPzgY4eIK8p+K4+O5o6aByO4fT8HIEiQcACix0v72Xdh70Nl/xryMaJl9M72Ws2kb/c+FVeIWQrt8aTZXox8jMuAcBQFBpSUHmyck601KIJGs/EDretYfrOLE1Gl1OJVU7qvwCYBtp00YC84knSkP8i0UcsuMd9xgEmJJy5djm7P0z6esQi8LQp4kkMfyLbJEqp/gWRGzKPYV4B9T2FXRTzWvFYrhHiXlX8+bFuLY15oviMIir8LmG07BJw/QniLahP26DmqxA/7Soi2S70uBCqzBj9a2hAQC6ewGvxV2FgfSdtwHiuO02wNyfj+QCbDcyKlfu7zo7eZSrrKknF2BLT3JKYn3gxIR5o21AUYmSLSBGO29QziXdqzrwjrTk0k1KYbL2yFSTXgfdmbPyXYyuQttvu884+Amz0UXW0dMLlXx0OCabsIFXg3HzluDf8qCZBVyi3F4l19qGomUJljHYNLA78vjLnGGZMvIVFR4Ky+Lin0WGbXxpfx0p1kNEv4nXphjc5IJq4UWMtP73smcyxN2V7ErBxFt1FVZvfmSjXWH83EzUWqj+7AAjHd+zw4gFMkjy/em5kDvMGek/PlEqErZ0dwljSgk4+TL58jQdd1Aj7+6WMxOD4A2zUVI0h5HB3oP4CYSbAzsykVStFuFQvgE/a9KuQm0jsGaMHGxby/2R0CYm7ACw9WfACCs4ixNjyqt5qabJfe1tKlRsdIt228utr asPFfiGA uaEBsDtgyfInnhXqYlt+nMZVb/wlqVuuIULoxl8d29CU5XYO7O2yGe8MQW8BiWQJPPphLbaa9GVGJh7oHfsqt5xCmVGqbLDJHfFuigIswepSTLhZAkRREEylGQQSvbEKPmYXm4yZIFhZyt4SLPrDwPYUaTGrNndc0NeYTui5BuqZTrNwBz7kthONHZrhTkwEeZ2pJD9yl09LSYZvGCliOVFbIAeSNP6VeNdNW4wFYM3U43F82mKB0aPYVVJybdsCFGMkKBgPm/ME0S7f7MSOh3/lFy6WrweGIqTe+UF5AcoDXeFpKAFRLeMhlqQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000064, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: In the shrink_folio_list() function, demote_folio_list() can be called multiple times, which can lead to inaccurate demotion statistics if the number of demoted pages is not accumulated correctly. Accumulate the nr_demoted count across multiple calls to demote_folio_list(), ensuring accurate reporting of demotion statistics. Fixes: f77f0c751478 ("mm,memcg: provide per-cgroup counters for NUMA balancing operations") Signed-off-by: Li Zhijian Acked-by: Kaiyang Zhao --- mm/vmscan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 9a859b7d18d7..430d580e37dd 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1522,7 +1522,7 @@ static unsigned int shrink_folio_list(struct list_head *folio_list, /* 'folio_list' is always empty here */ /* Migrate folios selected for demotion */ - stat->nr_demoted = demote_folio_list(&demote_folios, pgdat); + stat->nr_demoted += demote_folio_list(&demote_folios, pgdat); nr_reclaimed += stat->nr_demoted; /* Folios that could not be demoted are still in @demote_folios */ if (!list_empty(&demote_folios)) {