Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Muchun Song <muchun.song@linux.dev>
To: Weilin Tong <tongweilin@linux.alibaba.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Oscar Salvador <osalvador@suse.de>,
	David Hildenbrand <david@kernel.org>,
	Sidhartha Kumar <sidhartha.kumar@oracle.com>,
	Lorenzo Stoakes <ljs@kernel.org>,
	Dan Carpenter <error27@gmail.com>,
	Baolin Wang <baolin.wang@linux.alibaba.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] ipc/shm: fix RSS accounting for hugetlb shared memory
Date: Wed, 14 Oct 2026 16:23:38 +0800	[thread overview]
Message-ID: <05518093-AA04-4525-96F2-FC7AC327DCDF@linux.dev> (raw)
In-Reply-To: <20261014082218.2236088-1-tongweilin@linux.alibaba.com>



> On Oct 14, 2026, at 16:22, Weilin Tong <tongweilin@linux.alibaba.com> wrote:
> 
> Commit a08c7193e4f1 ("mm/filemap: remove hugetlb special casing in
> filemap.c") changed mapping->nrpages to count base pages for hugetlb
> folios. However, shm_add_rss_swap() still multiplies it by
> pages_per_huge_page(), overcounting RSS in both SHM_INFO and
> /proc/sysvipc/shm.
> 
> Use mapping->nrpages for RSS accounting across all backing types, and
> account swap only for non-hugetlb shmem. Use READ_ONCE() for both counters
> instead of info->lock, which does not protect nrpages and cannot provide
> a consistent snapshot.
> 
> Fixes: a08c7193e4f1 ("mm/filemap: remove hugetlb special casing in filemap.c")
> Suggested-by: Muchun Song <muchun.song@linux.dev>
> Signed-off-by: Weilin Tong <tongweilin@linux.alibaba.com>

Acked-by: Muchun Song <muchun.song@linux.dev>

Thanks.



      reply	other threads:[~2026-10-14  8:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-14  8:22 [PATCH v2] ipc/shm: fix RSS accounting for hugetlb shared memory Weilin Tong
2026-10-14  8:23 ` Muchun Song [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=05518093-AA04-4525-96F2-FC7AC327DCDF@linux.dev \
    --to=muchun.song@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=david@kernel.org \
    --cc=error27@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=osalvador@suse.de \
    --cc=sidhartha.kumar@oracle.com \
    --cc=tongweilin@linux.alibaba.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