All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anshuman Khandual <anshuman.khandual@arm.com>
To: Hugh Dickins <hughd@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Zi Yan <ziy@nvidia.com>, Yang Shi <shy828301@gmail.com>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH] mm/thp: Update mm_struct's MM_ANONPAGES stat for huge zero pages
Date: Fri, 21 May 2021 09:48:11 +0530	[thread overview]
Message-ID: <8fa7fea6-4176-32fd-2c6a-abb6b73d0d13@arm.com> (raw)
In-Reply-To: <alpine.LSU.2.11.2105201852230.5752@eggly.anvils>



On 5/21/21 7:47 AM, Hugh Dickins wrote:
> On Tue, 18 May 2021, Anshuman Khandual wrote:
> 
>> Although the zero huge page is being shared across various processes, each
>> mapping needs to update its mm_struct's MM_ANONPAGES stat by HPAGE_PMD_NR
>> to be consistent. This just updates the stats in set_huge_zero_page() after
>> the mapping gets created and in zap_huge_pmd() when mapping gets destroyed.
>>
>> 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>
> 
> NAK.
> 
> For consistency with what? In the all the years that the huge zero page

Huge zero page after all is an anon mapping. Hence why it must not be
counted for process rss MM_ANONPAGES accounting ? Is there a specific
reason why zero huge pages should not counted for MM_ANONPAGES ? Does
not it risk an inaccurate MM_ANONPAGES accounting for the processes
using huge zero pages ?

> has existed, it has been intentionally exempted from rss accounting:
> consistent with the small zero page, which itself has always been
> intentionally exempted from rss accounting. In fact, that's a good part

Why are small zero pages exempted from rss accounting which in turn
might have caused huge zero page to take the same approach as well ?

> of the reason the huge zero page was introduced (see 4a6c1297268c).

Huge zero page reduces memory consumption on read faults which is a
definite advantage but would there be a problem if rss stat goes up
for each huge zero page mapping instances. The commit mentioned here
talks about increase in actual memory utilization as seen from the
rss accounting stat, without huge zero page usage.

I am wondering if actual memory usage remains the same (reduced with
huge zero page usage), what could be the problem in an increased
MM_ANONPAGES accounting for a given process. Dont we update the rss
accounting for shared memory as well ?

> 
> To change that now will break any users depending on it.

Just to understand it correctly, are rss accounting procedures/methods
something which cannot be changed as users are currently dependent on
it ? OR this proposal here is not a good enough reason to change it ?

> 
> Not to mention the
> BUG: Bad rss-counter state mm:00000000aa61ef82 type:MM_ANONPAGES val:512
> I just got from mmotm.

Okay, unfortunately some how did not see this problem while testing. Is
there a specific test case which will be able to trigger this bug ?

- Anshuman

  reply	other threads:[~2021-05-21  4:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-18  4:48 [PATCH] mm/thp: Update mm_struct's MM_ANONPAGES stat for huge zero pages Anshuman Khandual
2021-05-18 14:12 ` Zi Yan
2021-05-21  2:17 ` Hugh Dickins
2021-05-21  2:17   ` Hugh Dickins
2021-05-21  4:18   ` Anshuman Khandual [this message]
2021-05-21  5:56     ` Hugh Dickins
2021-05-21  5:56       ` Hugh Dickins

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=8fa7fea6-4176-32fd-2c6a-abb6b73d0d13@arm.com \
    --to=anshuman.khandual@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=hughd@google.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=shy828301@gmail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.