linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: Jan Glauber <jglauber@digitalocean.com>, akpm@linux-foundation.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Huang,
	Ying" <ying.huang@intel.com>
Subject: Re: [PATCH v3] mm: Fix shmem THP counters on migration
Date: Fri, 23 Jun 2023 10:07:30 +0800	[thread overview]
Message-ID: <9ff605a5-a989-01f2-e629-e52bb50201a7@linux.alibaba.com> (raw)
In-Reply-To: <20230622094720.510540-1-jglauber@digitalocean.com>



On 6/22/2023 5:47 PM, Jan Glauber wrote:
> 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.
> 
> Signed-off-by: Jan Glauber <jglauber@digitalocean.com>

LGTM. Thanks.
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>

> ---
> v3: Use folio_test_pmd_mappable instead of folio_test_transhuge
> v2: Fix compile error
> ---
>   mm/migrate.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/mm/migrate.c b/mm/migrate.c
> index 01cac26a3127..6ef8b1dea2e6 100644
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -492,6 +492,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)) {


      reply	other threads:[~2023-06-23  2:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-22  9:47 Jan Glauber
2023-06-23  2:07 ` Baolin Wang [this message]

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=9ff605a5-a989-01f2-e629-e52bb50201a7@linux.alibaba.com \
    --to=baolin.wang@linux.alibaba.com \
    --cc=akpm@linux-foundation.org \
    --cc=jglauber@digitalocean.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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