The patch titled Subject: mm: fix shmem THP counters on migration has been added to the -mm mm-unstable branch. Its filename is mm-fix-shmem-thp-counters-on-migration.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-fix-shmem-thp-counters-on-migration.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Jan Glauber <jglauber@xxxxxxxxxxxxxxxx> Subject: mm: fix shmem THP counters on migration Date: Mon, 19 Jun 2023 12:33:51 +0200 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. Link: https://lkml.kernel.org/r/20230619103351.234837-1-jglauber@xxxxxxxxxxxxxxxx Signed-off-by: Jan Glauber <jglauber@xxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/migrate.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/mm/migrate.c~mm-fix-shmem-thp-counters-on-migration +++ a/mm/migrate.c @@ -486,6 +486,11 @@ int folio_migrate_mapping(struct address 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_transhuge(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)) { _ Patches currently in -mm which might be from jglauber@xxxxxxxxxxxxxxxx are mm-fix-shmem-thp-counters-on-migration.patch