From: "Michal Koutný" <mkoutny@suse.com>
To: Leon Huang Fu <leon.huangfu@shopee.com>
Cc: akpm@linux-foundation.org, cgroups@vger.kernel.org,
corbet@lwn.net, hannes@cmpxchg.org, jack@suse.cz,
joel.granados@kernel.org, kyle.meyer@hpe.com,
lance.yang@linux.dev, laoar.shao@gmail.com,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, mclapinski@google.com, mhocko@kernel.org,
muchun.song@linux.dev, roman.gushchin@linux.dev,
shakeel.butt@linux.dev, tj@kernel.org
Subject: Re: [PATCH mm-new v3] mm/memcontrol: Add memory.stat_refresh for on-demand stats flushing
Date: Tue, 11 Nov 2025 20:01:16 +0100 [thread overview]
Message-ID: <5xyq3w4jlewi4gt326exj45piti46vrsqkxnh4jzxmsgl24rm6@ivoslsgvgkp3> (raw)
In-Reply-To: <20251111061343.71045-1-leon.huangfu@shopee.com>
[-- Attachment #1: Type: text/plain, Size: 1530 bytes --]
On Tue, Nov 11, 2025 at 02:13:42PM +0800, Leon Huang Fu <leon.huangfu@shopee.com> wrote:
> Fewer CPUs?
Your surprise makes me realize I confused this with something else [1]
where harnessing the job to a subset of CPUs (e.g. with cpuset) would
reduce the accumulated error. But memory.stat's threshold is static (and
stricter affinity would actually render the threshold relatively worse).
> We are going to run kernels on 224/256 cores machines, and the flush threshold
> is 16384 on a 256-core machine. That means we will have stale statistics often,
> and we will need a way to improve the stats accuracy.
(The theory behind the threshold is that you'd also need to amortize
proportionally more updates.)
> The bpf code and the error message are attached at last section.
(Thanks, wondering about it...)
>
> >
> > All in all, I'd like to have more backing data on insufficiency of (all
> > the) rstat optimizations before opening explicit flushes like this
> > (especially when it's meant to be exposed by BPF already).
> >
>
> It's proving non-trivial to capture a persuasive delta. The global worker
> already flushes rstat every two seconds (2UL*HZ), so the window where
> userspace can observe stale numbers is short.
This is the important bit -- even though you can see it only rarely do
you refer to the LTPs failures or do you have some consumer of the stats
that fails terribly with the imprecise numbers?
Thanks,
Michal
[1] Per-cpu stocks that affect memory.current.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 265 bytes --]
next prev parent reply other threads:[~2025-11-11 19:01 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-10 10:19 Leon Huang Fu
2025-11-10 11:28 ` Michal Hocko
2025-11-11 6:12 ` Leon Huang Fu
2025-11-10 11:52 ` Harry Yoo
2025-11-11 6:12 ` Leon Huang Fu
2025-11-10 13:50 ` Michal Koutný
2025-11-10 16:04 ` Tejun Heo
2025-11-11 6:27 ` Leon Huang Fu
2025-11-11 1:00 ` Chen Ridong
2025-11-11 6:44 ` Leon Huang Fu
2025-11-12 0:56 ` Chen Ridong
2025-11-12 14:02 ` Michal Koutný
2025-11-11 6:13 ` Leon Huang Fu
2025-11-11 18:52 ` Tejun Heo
2025-11-11 19:01 ` Michal Koutný [this message]
2025-11-11 8:10 ` Michal Hocko
2025-11-11 19:10 ` Waiman Long
2025-11-11 19:47 ` Michal Hocko
2025-11-11 20:44 ` Waiman Long
2025-11-11 21:01 ` Michal Hocko
2025-11-12 14:02 ` Michal Koutný
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=5xyq3w4jlewi4gt326exj45piti46vrsqkxnh4jzxmsgl24rm6@ivoslsgvgkp3 \
--to=mkoutny@suse.com \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=corbet@lwn.net \
--cc=hannes@cmpxchg.org \
--cc=jack@suse.cz \
--cc=joel.granados@kernel.org \
--cc=kyle.meyer@hpe.com \
--cc=lance.yang@linux.dev \
--cc=laoar.shao@gmail.com \
--cc=leon.huangfu@shopee.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mclapinski@google.com \
--cc=mhocko@kernel.org \
--cc=muchun.song@linux.dev \
--cc=roman.gushchin@linux.dev \
--cc=shakeel.butt@linux.dev \
--cc=tj@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox