linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Yang Shi <shy828301@gmail.com>
To: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Linux MM <linux-mm@kvack.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	 Zi Yan <ziy@nvidia.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [RFC] mm/thp: Update mm's MM_ANONPAGES stat in set_huge_zero_page()
Date: Thu, 13 May 2021 09:50:55 -0700	[thread overview]
Message-ID: <CAHbLzkpMF9b148ois7vMPrB9TVQNAfObWD=b02RFFvYBGhX3mg@mail.gmail.com> (raw)
In-Reply-To: <1620890438-9127-1-git-send-email-anshuman.khandual@arm.com>

On Thu, May 13, 2021 at 12:20 AM Anshuman Khandual
<anshuman.khandual@arm.com> wrote:
>
> Although the zero huge page is being shared across various processes, each
> mapping needs to update its mm's MM_ANONPAGES stat by HPAGE_PMD_NR in order
> to be consistent. This just updates the stats in set_huge_zero_page() after
> the mapping gets created.

I don't get why MM_ANONPAGES needs to be inc'ed when huge zero page is
installed. This may cause inconsistency between some counters, for
example, MM_ANONPAGES may be much bigger than anon LRU.

MM_ANONPAGES should not be inc'ed unless a new page is allocated and
installed, right?

>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Zi Yan <ziy@nvidia.com>
> Cc: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
> Should it update MM_SHMEM_PAGES instead ? Applies on latest mainline.
>
>  mm/huge_memory.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index 63ed6b25deaa..262703304807 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -706,6 +706,7 @@ static void set_huge_zero_page(pgtable_t pgtable, struct mm_struct *mm,
>         if (pgtable)
>                 pgtable_trans_huge_deposit(mm, pmd, pgtable);
>         set_pmd_at(mm, haddr, pmd, entry);
> +       add_mm_counter(mm, MM_ANONPAGES, HPAGE_PMD_NR);
>         mm_inc_nr_ptes(mm);
>  }
>
> --
> 2.20.1
>
>


  parent reply	other threads:[~2021-05-13 16:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-13  7:20 [RFC] mm/thp: Update mm's MM_ANONPAGES stat in set_huge_zero_page() Anshuman Khandual
2021-05-13 14:12 ` Zi Yan
2021-05-17  3:51   ` Anshuman Khandual
2021-05-17 14:48     ` Zi Yan
2021-05-13 16:50 ` Yang Shi [this message]
2021-05-13 16:59   ` Yang Shi

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='CAHbLzkpMF9b148ois7vMPrB9TVQNAfObWD=b02RFFvYBGhX3mg@mail.gmail.com' \
    --to=shy828301@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=anshuman.khandual@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ziy@nvidia.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;
as well as URLs for NNTP newsgroup(s).