From: Mateusz Guzik <mjguzik@gmail.com>
To: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>
Cc: "Andrew Morton" <akpm@linux-foundation.org>,
"Steven Rostedt" <rostedt@goodmis.org>,
"Masami Hiramatsu" <mhiramat@kernel.org>,
"Mathieu Desnoyers" <mathieu.desnoyers@efficios.com>,
"Dennis Zhou" <dennis@kernel.org>, "Tejun Heo" <tj@kernel.org>,
"Christoph Lameter" <cl@linux.com>,
"Martin Liu" <liumartin@google.com>,
"David Rientjes" <rientjes@google.com>,
"Christian König" <christian.koenig@amd.com>,
"Shakeel Butt" <shakeel.butt@linux.dev>,
"Johannes Weiner" <hannes@cmpxchg.org>,
"Sweet Tea Dorminy" <sweettea@google.com>,
"Lorenzo Stoakes" <lorenzo.stoakes@oracle.com>,
"Liam R . Howlett" <Liam.Howlett@oracle.com>,
"Suren Baghdasaryan" <surenb@google.com>,
"Vlastimil Babka" <vbabka@suse.cz>,
"Christian Brauner" <brauner@kernel.org>,
"Wei Yang" <richard.weiyang@gmail.com>,
"David Hildenbrand" <david@redhat.com>,
"Miaohe Lin" <linmiaohe@huawei.com>,
"Al Viro" <viro@zeniv.linux.org.uk>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
linux-trace-kernel@vger.kernel.org, "Yu Zhao" <yuzhao@google.com>,
"Roman Gushchin" <roman.gushchin@linux.dev>
Subject: Re: [RFC PATCH v2] mm: use per-numa-node atomics instead of percpu_counters
Date: Thu, 3 Apr 2025 18:39:23 +0200 [thread overview]
Message-ID: <CAGudoHF_sD0T9JHSpJyJiBqKd2cO+5jFjvNBpEx4Mp+uK044PQ@mail.gmail.com> (raw)
In-Reply-To: <20250331223516.7810-2-sweettea-kernel@dorminy.me>
On Tue, Apr 1, 2025 at 12:36 AM Sweet Tea Dorminy
<sweettea-kernel@dorminy.me> wrote:
>
> [Resend as requested as RFC and minus prereq-patch-id junk]
>
> Recently, several internal services had an RSS usage regression as part of a
> kernel upgrade. Previously, they were on a pre-6.2 kernel and were able to
> read RSS statistics in a backup watchdog process to monitor and decide if
> they'd overrun their memory budget. Now, however, a representative service
> with five threads, expected to use about a hundred MB of memory, on a 250-cpu
> machine had memory usage tens of megabytes different from the expected amount
> -- this constituted a significant percentage of inaccuracy, causing the
> watchdog to act.
>
[snip]
> I think the important part is that this improves accuracy; the current
> scheme is difficult to use on many-cored machines. It improves
> performance, but there are tradeoffs; but it tightly bounds the
> inaccuracy so that decisions can actually be reasonably made with the
> resulting numbers.
>
Even disregarding this specific report, a prior patch submission
points a result which is so off that it already constitutes a bug:
https://lwn.net/ml/linux-kernel/20220728204511.56348-1-ryncsn@gmail.com/
So something definitely needs to be done to improve the accuracy. But
that always will be a tradeoff vs update performance.
This brings me to a question: how often does the watchdog thing look
at the stats?
I wonder if it would make sense add another file to proc, similar to
"status", but returning *exact* values. So in particular with percpu
counters it would walk all CPUs on to generate the answer.
Then interested parties would still get an accurate count and not get
in the way, provided they don't relentlessly do it.
--
Mateusz Guzik <mjguzik gmail.com>
prev parent reply other threads:[~2025-04-03 16:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-31 22:35 [RFC PATCH v2] mm: use per-numa-node atomics instead of percpu_counters Sweet Tea Dorminy
2025-04-01 3:26 ` Kairui Song
2025-04-03 14:31 ` Mateusz Guzik
2025-04-04 16:51 ` Kairui Song
2025-04-08 7:46 ` Mateusz Guzik
2025-04-03 0:00 ` Shakeel Butt
2025-04-03 17:59 ` Mathieu Desnoyers
2025-04-04 16:02 ` Mathieu Desnoyers
2025-04-03 16:39 ` Mateusz Guzik [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=CAGudoHF_sD0T9JHSpJyJiBqKd2cO+5jFjvNBpEx4Mp+uK044PQ@mail.gmail.com \
--to=mjguzik@gmail.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=brauner@kernel.org \
--cc=christian.koenig@amd.com \
--cc=cl@linux.com \
--cc=david@redhat.com \
--cc=dennis@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=linmiaohe@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=liumartin@google.com \
--cc=lorenzo.stoakes@oracle.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=richard.weiyang@gmail.com \
--cc=rientjes@google.com \
--cc=roman.gushchin@linux.dev \
--cc=rostedt@goodmis.org \
--cc=shakeel.butt@linux.dev \
--cc=surenb@google.com \
--cc=sweettea-kernel@dorminy.me \
--cc=sweettea@google.com \
--cc=tj@kernel.org \
--cc=vbabka@suse.cz \
--cc=viro@zeniv.linux.org.uk \
--cc=yuzhao@google.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).