linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: 18810879172@163.com
To: akpm@linux-foundation.org
Cc: david@redhat.com, zhengqi.arch@bytedance.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, wangxuewen <wangxuewen@kylinos.cn>
Subject: [PATCH v1] mm/vmscan: Account hwpoisoned folios in reclaim statistics
Date: Wed,  2 Jul 2025 17:34:40 +0800	[thread overview]
Message-ID: <20250702093440.146967-1-18810879172@163.com> (raw)

From: wangxuewen <wangxuewen@kylinos.cn>

When encountering a hardware-poisoned folio in shrink_folio_list(),
we unmap and release the folio but fail to account it in the reclaim
statistics (sc->nr_reclaimed). This leads to an undercount of
actually reclaimed pages, potentially causing unnecessary additional
reclaim pressure.

Fix this by adding sc->nr_reclaimed += folio_nr_pages(folio) after
folio_put() in the hwpoison handling block. This matches the accounting
done in other reclaim paths.

Signed-off-by: wangxuewen <wangxuewen@kylinos.cn>
---
 mm/vmscan.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index f8dfd2864bbf..4c612f4b6e66 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1141,6 +1141,7 @@ static unsigned int shrink_folio_list(struct list_head *folio_list,
 			unmap_poisoned_folio(folio, folio_pfn(folio), false);
 			folio_unlock(folio);
 			folio_put(folio);
+			sc->nr_reclaimed += folio_nr_pages(folio);
 			continue;
 		}
 
-- 
2.34.1



             reply	other threads:[~2025-07-02  9:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-02  9:34 18810879172 [this message]
2025-07-02  9:44 ` David Hildenbrand
2025-07-04  3:14   ` wangxuewen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250702093440.146967-1-18810879172@163.com \
    --to=18810879172@163.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=wangxuewen@kylinos.cn \
    --cc=zhengqi.arch@bytedance.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox