[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250926183343.54956-1-sj@kernel.org>
Date: Fri, 26 Sep 2025 11:33:43 -0700
From: SeongJae Park <sj@...nel.org>
To: Joshua Hahn <joshua.hahnjy@...il.com>
Cc: SeongJae Park <sj@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Johannes Weiner <hannes@...xchg.org>,
Chris Mason <clm@...com>,
Kiryl Shutsemau <kirill@...temov.name>,
"Liam R. Howlett" <Liam.Howlett@...cle.com>,
Brendan Jackman <jackmanb@...gle.com>,
David Hildenbrand <david@...hat.com>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
Michal Hocko <mhocko@...e.com>,
Mike Rapoport <rppt@...nel.org>,
Suren Baghdasaryan <surenb@...gle.com>,
Vlastimil Babka <vbabka@...e.cz>,
Zi Yan <ziy@...dia.com>,
linux-kernel@...r.kernel.org,
linux-mm@...ck.org,
kernel-team@...a.com
Subject: Re: [PATCH v2 1/4] mm/page_alloc/vmstat: Simplify refresh_cpu_vm_stats change detection
On Fri, 26 Sep 2025 11:24:37 -0700 Joshua Hahn <joshua.hahnjy@...il.com> wrote:
[...]
> > > @@ -839,7 +839,7 @@ static int refresh_cpu_vm_stats(bool do_pagesets)
> > > if (do_pagesets) {
> > > cond_resched();
> > >
> > > - changes += decay_pcp_high(zone, this_cpu_ptr(pcp));
> > > + changed |= decay_pcp_high(zone, this_cpu_ptr(pcp));
> >
> > I'm not a fan of bit operations unless it provides clear benefits.
> > What about below?
> >
> > if (decay_pcp_high(zone, this_cpu_ptr(pcp)) && !changed)
> > changed = truee;
>
> Here, what if I change it to just:
>
> if (decay_pcp_high(zone, this_cpu_ptr(pcp))
> changed = true;
Looks nice to me! :)
>
> Since even if changed == true already, this will be a no-op.
I was thinking the compiler might or might not emit unnecessary writes, but I
don't really care that. Your suggested version looks good to me :)
>
> > Just a personal and trivial taste. No strong opinion. If you don't strongly
> > feel my suggestion is better, please keep the original code.
>
> I feel like if someone (you) feels like bitwise operations here makes it
> less clear what the code is doing, others may feel the same way as well!
> Happy to make the change to hopefully make it more easily understandable
> what is happening.
Thank you Joshua!
[...]
> Thanks SJ, I hope you have a great day!
You too! Plus, great weekend!
Thanks,
SJ
[...]
Powered by blists - more mailing lists