From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Nirmoy Das <nirmoyd@nvidia.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: David Hildenbrand <david@kernel.org>,
Lorenzo Stoakes <ljs@kernel.org>,
"Liam R . Howlett" <liam@infradead.org>,
Vlastimil Babka <vbabka@kernel.org>,
Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>,
Shakeel Butt <shakeel.butt@linux.dev>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [RFC PATCH] mm: use precise current RSS for high-water accounting
Date: Thu, 23 Jul 2026 09:47:13 -0400 [thread overview]
Message-ID: <bd3facf5-cc4e-4fa3-95cf-0f4aa926ae23@efficios.com> (raw)
In-Reply-To: <20260723134158.1473841-1-nirmoyd@nvidia.com>
On 2026-07-23 09:41, Nirmoy Das wrote:
> get_mm_rss() reads approximate per-CPU RSS counters. On large systems,
> this can under-report the current RSS used for high-water accounting.
Did you compare this with my hierarchical percpu counters series ?
https://lore.kernel.org/lkml/20260707131544.75906-1-mathieu.desnoyers@efficios.com/
I've sent it to Andrew two weeks ago but have not heard back from him
though. My series attack the same issue you are trying to solve without
increasing overhead when reading those counters.
Thanks,
Mathieu
>
> On a 352-CPU, 2-node system with 64 KiB pages, reproduce with:
>
> sudo -E env LTPROOT=/opt/ltp \
> PATH=/opt/ltp/testcases/bin:$PATH LTP_TIMEOUT_MUL=5 \
> bash -c "cd /opt/ltp/testcases/bin && ./getrusage03"
>
> The test failed 10/10 times with child.children=270336 instead of
> 307200.
>
> Use get_mm_rss_sum() when reading and resetting high-water RSS. Keep
> update_hiwater_rss() on the approximate path because it runs before
> RSS-decreasing operations.
>
> The patched kernel passed getrusage03 20/20 times. getrusage01,
> getrusage02 and getrusage04 also passed.
>
> Fixes: f1a7941243c1 ("mm: convert mm's rss stats into percpu_counter")
> Cc: stable@vger.kernel.org
> Assisted-by: Cursor:claude-opus-4-8-thinking-max
> Signed-off-by: Nirmoy Das <nirmoyd@nvidia.com>
> ---
> include/linux/mm.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index 485df9c2dbddb..1b613c6356baa 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -3405,7 +3405,7 @@ static inline unsigned long get_mm_rss_sum(struct mm_struct *mm)
>
> static inline unsigned long get_mm_hiwater_rss(struct mm_struct *mm)
> {
> - return max(mm->hiwater_rss, get_mm_rss(mm));
> + return max(mm->hiwater_rss, get_mm_rss_sum(mm));
> }
>
> static inline unsigned long get_mm_hiwater_vm(struct mm_struct *mm)
> @@ -3429,7 +3429,7 @@ static inline void update_hiwater_vm(struct mm_struct *mm)
>
> static inline void reset_mm_hiwater_rss(struct mm_struct *mm)
> {
> - mm->hiwater_rss = get_mm_rss(mm);
> + mm->hiwater_rss = get_mm_rss_sum(mm);
> }
>
> static inline void setmax_mm_hiwater_rss(unsigned long *maxrss,
>
> base-commit: 4539944e515183668109bdf4d0c3d7d228383d88
--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com
next prev parent reply other threads:[~2026-07-23 13:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-23 13:41 [RFC PATCH] mm: use precise current RSS for high-water accounting Nirmoy Das
2026-07-23 13:47 ` Mathieu Desnoyers [this message]
2026-07-23 16:21 ` Nirmoy Das
2026-07-23 16:31 ` Mathieu Desnoyers
2026-07-23 17:07 ` Nirmoy Das
2026-07-23 16:58 ` Lorenzo Stoakes (ARM)
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=bd3facf5-cc4e-4fa3-95cf-0f4aa926ae23@efficios.com \
--to=mathieu.desnoyers@efficios.com \
--cc=akpm@linux-foundation.org \
--cc=david@kernel.org \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=nirmoyd@nvidia.com \
--cc=rppt@kernel.org \
--cc=shakeel.butt@linux.dev \
--cc=stable@vger.kernel.org \
--cc=surenb@google.com \
--cc=vbabka@kernel.org \
/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.