lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aEnTSuVy2Aq8jRk8@yury>
Date: Wed, 11 Jun 2025 15:04:42 -0400
From: Yury Norov <yury.norov@...il.com>
To: John Stultz <jstultz@...gle.com>
Cc: I Hsin Cheng <richard120310@...il.com>, tglx@...utronix.de,
	sboyd@...nel.org, linux-kernel@...r.kernel.org,
	jserv@...s.ncku.edu.tw, skhan@...uxfoundation.org,
	linux-kernel-mentees@...ts.linux.dev
Subject: Re: [PATCH] clocksource: Utilize cpumask_next_wrap() to shrink code
 size

On Wed, Jun 11, 2025 at 11:35:13AM -0700, John Stultz wrote:
> On Wed, Jun 11, 2025 at 3:45 AM I Hsin Cheng <richard120310@...il.com> wrote:
> >
> > Simplify the procedure of CPU random selection under
> > "clocksource_verify_choose_cpus()" with "cpumask_next_wrap()". The
> > logic is still the same but with this change it can shrink the code size
> > by 18 bytes and increase readability.
> >
> > $ ./scripts/bloat-o-meter vmlinux_old vmlinux_new
> > add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-18 (-18)
> > Function                                     old     new   delta
> > clocksource_verify_percpu                   1064    1046     -18
> >
> > Signed-off-by: I Hsin Cheng <richard120310@...il.com>
> > ---
> >  kernel/time/clocksource.c | 4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)
> >
> > diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
> > index bb48498ebb5a..ab580873408b 100644
> > --- a/kernel/time/clocksource.c
> > +++ b/kernel/time/clocksource.c
> > @@ -343,9 +343,7 @@ static void clocksource_verify_choose_cpus(void)
> >          */
> >         for (i = 1; i < n; i++) {
> >                 cpu = get_random_u32_below(nr_cpu_ids);
> > -               cpu = cpumask_next(cpu - 1, cpu_online_mask);
> > -               if (cpu >= nr_cpu_ids)
> > -                       cpu = cpumask_first(cpu_online_mask);
> > +               cpu = cpumask_next_wrap(cpu - 1, cpu_online_mask);
> >                 if (!WARN_ON_ONCE(cpu >= nr_cpu_ids))
> >                         cpumask_set_cpu(cpu, &cpus_chosen);
> >         }
> 
> I think Yury submitted the same change here recently:
>   https://lore.kernel.org/lkml/20250607141106.563924-3-yury.norov@gmail.com/
> 
> Though, I think he has another iteration needed as Thomas had feedback
> on the subject line.
> 
> The bloat-o-meter data is a nice inclusion here!
> 
> Yury: Would you be open to adapting I Hsin Cheng's commit message into
> yours and adding them as co-author via the Co-developed-by: tag?
> (Assuming I Hsin Cheng agrees - See
> Documentation/process/submitting-patches.rst for how to do this
> properly).

Yeah, bloat-o-meter report is good enough to add co-developed-by tag.
I Hsin, do you agree?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ