From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Jan Glauber <jglauber@digitalocean.com>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
"Huang, Ying" <ying.huang@intel.com>,
Andrew Morton <akpm@linux-foundation.org>,
Sasha Levin <sashal@kernel.org>
Subject: [PATCH 6.1.y 1/2] mm: fix shmem THP counters on migration
Date: Fri, 4 Dec 2026 07:44:48 -0500 [thread overview]
Message-ID: <20261204124355.3064748-1-sashal@kernel.org> (raw)
In-Reply-To: <2026120240-antibody-librarian-f579@gregkh>
From: Jan Glauber <jglauber@digitalocean.com>
[ Upstream commit 0b52c420350e8f9873ba62768cd8246827184408 ]
The per node numa_stat values for shmem don't change on page migration for
THP:
grep shmem /sys/fs/cgroup/machine.slice/.../memory.numa_stat:
shmem N0=1092616192 N1=10485760
shmem_thp N0=1092616192 N1=10485760
migratepages 9181 0 1:
shmem N0=0 N1=1103101952
shmem_thp N0=1092616192 N1=10485760
Fix that by updating shmem_thp counters likewise to shmem counters on page
migration.
[jglauber@digitalocean.com: use folio_test_pmd_mappable instead of folio_test_transhuge]
Link: https://lkml.kernel.org/r/20230622094720.510540-1-jglauber@digitalocean.com
Link: https://lkml.kernel.org/r/20230619103351.234837-1-jglauber@digitalocean.com
Signed-off-by: Jan Glauber <jglauber@digitalocean.com>
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: "Huang, Ying" <ying.huang@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Stable-dep-of: a2108a958143 ("mm/migrate: move NR_FILE_THPS on cross-node migration")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
mm/migrate.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/mm/migrate.c b/mm/migrate.c
index 0f3af8eb6356c..2ba17adb14134 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -480,6 +480,11 @@ int folio_migrate_mapping(struct address_space *mapping,
if (folio_test_swapbacked(folio) && !folio_test_swapcache(folio)) {
__mod_lruvec_state(old_lruvec, NR_SHMEM, -nr);
__mod_lruvec_state(new_lruvec, NR_SHMEM, nr);
+
+ if (folio_test_pmd_mappable(folio)) {
+ __mod_lruvec_state(old_lruvec, NR_SHMEM_THPS, -nr);
+ __mod_lruvec_state(new_lruvec, NR_SHMEM_THPS, nr);
+ }
}
#ifdef CONFIG_SWAP
if (folio_test_swapcache(folio)) {
--
2.53.0
next prev parent reply other threads:[~2026-12-04 12:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 16:10 FAILED: patch "[PATCH] mm/migrate: move NR_FILE_THPS on cross-node migration" failed to apply to 6.1-stable tree gregkh
2026-12-04 12:44 ` Sasha Levin [this message]
2026-12-04 12:44 ` [PATCH 6.1.y 2/2] mm/migrate: move NR_FILE_THPS on cross-node migration Sasha Levin
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=20261204124355.3064748-1-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=jglauber@digitalocean.com \
--cc=stable@vger.kernel.org \
--cc=ying.huang@intel.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