summaryrefslogtreecommitdiff
path: root/rust/kernel
diff options
context:
space:
mode:
authorWeilin Tong <tongweilin@linux.alibaba.com>2026-10-14 16:22:18 +0800
committerAndrew Morton <akpm@linux-foundation.org>2026-10-24 01:56:34 -0700
commite387ebe5cd31720b1e0281fd045be4eef36fadb3 (patch)
tree7be9d0afc55d2fece2761d7f02b56576e8b4d222 /rust/kernel
parent00a51d09912a12232d47bc282b74397908d1ed5c (diff)
ipc/shm: fix RSS accounting for hugetlb shared memory
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. Link: https://lore.kernel.org/20261014082218.2236088-1-tongweilin@linux.alibaba.com Fixes: a08c7193e4f1 ("mm/filemap: remove hugetlb special casing in filemap.c") Signed-off-by: Weilin Tong <tongweilin@linux.alibaba.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Suggested-by: Muchun Song <muchun.song@linux.dev> Acked-by: Muchun Song <muchun.song@linux.dev> Cc: Oscar Salvador <osalvador@suse.de> Cc: David Hildenbrand <david@kernel.org> Cc: Sidhartha Kumar <sidhartha.kumar@oracle.com> Cc: Lorenzo Stoakes <ljs@kernel.org> Cc: Dan Carpenter <error27@gmail.com> Cc: Baolin Wang <baolin.wang@linux.alibaba.com> Cc: <stable@vger.kernel.org>
Diffstat (limited to 'rust/kernel')
0 files changed, 0 insertions, 0 deletions