From: Shakeel Butt <shakeel.butt@linux.dev>
To: Harry Yoo <harry.yoo@oracle.com>, Dev Jain <dev.jain@arm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Johannes Weiner <hannes@cmpxchg.org>,
Michal Hocko <mhocko@kernel.org>,
Roman Gushchin <roman.gushchin@linux.dev>,
Muchun Song <muchun.song@linux.dev>,
Qi Zheng <qi.zheng@linux.dev>, Vlastimil Babka <vbabka@suse.cz>,
linux-mm@kvack.org, cgroups@vger.kernel.org,
linux-kernel@vger.kernel.org,
Meta kernel team <kernel-team@meta.com>,
shy828301@gmail.com, cl@gentwo.org
Subject: Re: [PATCH 1/4] memcg: use mod_node_page_state to update stats
Date: Wed, 11 Feb 2026 17:31:25 -0800 [thread overview]
Message-ID: <aY0szfVYWR_eWdpn@linux.dev> (raw)
In-Reply-To: <7df681ae0f8254f09de0b8e258b909eaacafadf4@linux.dev>
+Yang Shi and Christoph Lameter
On Thu, Feb 05, 2026 at 05:58:44AM +0000, Shakeel Butt wrote:
> >
> > On Thu, Feb 05, 2026 at 10:50:06AM +0530, Dev Jain wrote:
> >
> > >
> > > On 05/02/26 2:08 am, Shakeel Butt wrote:
> > > On Mon, Feb 02, 2026 at 02:23:54PM +0530, Dev Jain wrote:
> > > On 02/02/26 10:24 am, Shakeel Butt wrote:
> > > Hello Shakeel,
> > >
> > > We are seeing a regression in micromm/munmap benchmark with this patch, on arm64 -
> > > the benchmark mmmaps a lot of memory, memsets it, and measures the time taken
> > > to munmap. Please see below if my understanding of this patch is correct.
> > >
> > > Thanks for the report. Are you seeing regression in just the benchmark
> > > or some real workload as well? Also how much regression are you seeing?
> > > I have a kernel rebot regression report [1] for this patch as well which
> > > says 2.6% regression and thus it was on the back-burner for now. I will
> > > take look at this again soon.
> > >
> > > The munmap regression is ~24%. Haven't observed a regression in any other
> > > benchmark yet.
> > > Please share the code/benchmark which shows such regression, also if you can
> > > share the perf profile, that would be awesome.
> > > https://gitlab.arm.com/tooling/fastpath/-/blob/main/containers/microbench/micromm.c
> > > You can run this with
> > > ./micromm 0 munmap 10
> > >
> > > Don't have a perf profile, I measured the time taken by above command, with and
> > > without the patch.
> > >
> > > Hi Dev, can you please try the following patch?
> > >
> > > From 40155feca7e7bc846800ab8449735bdb03164d6d Mon Sep 17 00:00:00 2001
> > > From: Shakeel Butt <shakeel.butt@linux.dev>
> > > Date: Wed, 4 Feb 2026 08:46:08 -0800
> > > Subject: [PATCH] vmstat: use preempt disable instead of try_cmpxchg
> > >
> > > Signed-off-by: Shakeel Butt <shakeel.butt@linux.dev>
> > > ---
> > >
> > [...snip...]
> >
> > >
> > > Thanks for looking into this.
> > >
> > > But this doesn't solve it :( preempt_disable() contains a compiler barrier,
> > > probably that's why.
> > >
> > I think the reason why it doesn't solve the regression is because of how
> > arm64 implements this_cpu_add_8() and this_cpu_try_cmpxchg_8().
> >
> > On arm64, IIUC both this_cpu_try_cmpxchg_8() and this_cpu_add_8() are
> > implemented using LL/SC instructions or LSE atomics (if supported).
> >
> > See:
> > - this_cpu_add_8()
> > -> __percpu_add_case_64
> > (which is generated from PERCPU_OP)
> >
> > - this_cpu_try_cmpxchg_8()
> > -> __cpu_fallback_try_cmpxchg(..., this_cpu_cmpxchg_8)
> > -> this_cpu_cmpxchg_8()
> > -> cmpxchg_relaxed()
> > -> raw_cmpxchg_relaxed()
> > -> arch_cmpxchg_relaxed()
> > -> __cmpxchg_wrapper()
> > -> __cmpxchg_case_64()
> > -> __lse_ll_sc_body(_cmpxchg_case_64, ...)
> >
>
> Oh so it is arm64 specific issue. I tested on x86-64 machine and it solves
> the little regression it had before. So, on arm64 all this_cpu_ops i.e. without
> double underscore, uses LL/SC instructions.
>
> Need more thought on this.
>
It seems like Yang Shi is looking into improving this_cpu_ops for arm64.
https://lore.kernel.org/CAHbLzkpcN-T8MH6=W3jCxcFj1gVZp8fRqe231yzZT-rV_E_org@mail.gmail.com/
next prev parent reply other threads:[~2026-02-12 1:31 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-10 23:20 [PATCH 0/4] memcg: cleanup the memcg stats interfaces Shakeel Butt
2025-11-10 23:20 ` [PATCH 1/4] memcg: use mod_node_page_state to update stats Shakeel Butt
2025-11-11 1:39 ` Harry Yoo
2025-11-11 18:58 ` Roman Gushchin
2026-01-29 13:05 ` Dev Jain
2026-02-02 4:26 ` Shakeel Butt
2026-02-02 4:48 ` Dev Jain
2026-02-02 4:54 ` Shakeel Butt
2026-02-02 8:53 ` Dev Jain
2026-02-04 20:38 ` Shakeel Butt
2026-02-05 5:20 ` Dev Jain
2026-02-05 5:45 ` Harry Yoo
2026-02-05 5:58 ` Shakeel Butt
2026-02-10 7:38 ` Dev Jain
2026-02-10 16:29 ` Shakeel Butt
2026-02-11 7:37 ` Dev Jain
2026-02-11 8:53 ` Harry Yoo
2026-02-11 9:24 ` Shakeel Butt
2026-02-11 10:14 ` Harry Yoo
2026-02-12 5:16 ` Dev Jain
2026-02-12 5:14 ` Dev Jain
2026-02-12 1:31 ` Shakeel Butt [this message]
2025-11-10 23:20 ` [PATCH 2/4] memcg: remove __mod_lruvec_kmem_state Shakeel Butt
2025-11-11 1:46 ` Harry Yoo
2025-11-11 8:23 ` Qi Zheng
2025-11-11 18:58 ` Roman Gushchin
2025-11-10 23:20 ` [PATCH 3/4] memcg: remove __mod_lruvec_state Shakeel Butt
2025-11-11 5:21 ` Harry Yoo
2025-11-11 18:58 ` Roman Gushchin
2025-11-10 23:20 ` [PATCH 4/4] memcg: remove __lruvec_stat_mod_folio Shakeel Butt
2025-11-11 5:41 ` Harry Yoo
2025-11-11 18:59 ` Roman Gushchin
2025-11-11 0:59 ` [PATCH 0/4] memcg: cleanup the memcg stats interfaces Harry Yoo
2025-11-11 2:23 ` Qi Zheng
2025-11-11 2:39 ` Shakeel Butt
2025-11-11 2:48 ` Qi Zheng
2025-11-11 3:00 ` Shakeel Butt
2025-11-11 3:07 ` Qi Zheng
2025-11-11 3:18 ` Harry Yoo
2025-11-11 3:29 ` Qi Zheng
2025-11-11 3:05 ` Harry Yoo
2025-11-11 8:01 ` Sebastian Andrzej Siewior
2025-11-11 8:36 ` Qi Zheng
2025-11-11 16:45 ` Shakeel Butt
2025-11-12 2:11 ` Qi Zheng
2025-11-11 9:54 ` Vlastimil Babka
2025-11-11 19:01 ` Roman Gushchin
2025-11-11 19:34 ` Shakeel Butt
2025-11-15 19:27 ` Shakeel Butt
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=aY0szfVYWR_eWdpn@linux.dev \
--to=shakeel.butt@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=cl@gentwo.org \
--cc=dev.jain@arm.com \
--cc=hannes@cmpxchg.org \
--cc=harry.yoo@oracle.com \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=muchun.song@linux.dev \
--cc=qi.zheng@linux.dev \
--cc=roman.gushchin@linux.dev \
--cc=shy828301@gmail.com \
--cc=vbabka@suse.cz \
/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