[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAEXW_YSN66Ac1i5-4oanbRERc0C3hRD=3dnQNy6CtgCFTzvD0w@mail.gmail.com>
Date: Mon, 23 Jan 2023 10:00:14 -0500
From: Joel Fernandes <joel@...lfernandes.org>
To: Frederic Weisbecker <frederic@...nel.org>
Cc: linux-kernel@...r.kernel.org,
"Paul E. McKenney" <paulmck@...nel.org>,
Zhouyi Zhou <zhouzhouyi@...il.com>,
Will Deacon <will@...nel.org>, Marc Zyngier <maz@...nel.org>,
rcu <rcu@...r.kernel.org>,
Frederic Weisbecker <fweisbec@...il.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Ingo Molnar <mingo@...nel.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH] tick/nohz: Fix cpu_is_hotpluggable() by checking with
nohz subsystem
On Fri, Jan 20, 2023 at 5:25 PM Frederic Weisbecker <frederic@...nel.org> wrote:
>
> On Thu, Jan 19, 2023 at 08:44:35PM +0000, Joel Fernandes (Google) wrote:
> > -static int tick_nohz_cpu_down(unsigned int cpu)
> > +static int tick_nohz_cpu_hotplug_ret(unsigned int cpu)
> > {
> > /*
> > * The tick_do_timer_cpu CPU handles housekeeping duty (unbound
> > @@ -522,6 +522,16 @@ static int tick_nohz_cpu_down(unsigned int cpu)
> > return 0;
> > }
> >
> > +static int tick_nohz_cpu_down(unsigned int cpu)
> > +{
> > + return tick_nohz_cpu_hotplug_ret(cpu);
> > +}
> > +
> > +bool tick_nohz_cpu_hotpluggable(unsigned int cpu)
> > +{
> > + return tick_nohz_cpu_hotplug_ret(cpu) == 0;
>
> This is still calling the hotplug function for the CPU in order to know if the
> CPU is hotpluggable...
>
> Why not:
>
> diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
> index ba2ac1469d47..a46506f7ec6d 100644
> --- a/kernel/time/tick-sched.c
> +++ b/kernel/time/tick-sched.c
> @@ -532,7 +532,7 @@ void __init tick_nohz_full_setup(cpumask_var_t cpumask)
> tick_nohz_full_running = true;
> }
>
> -static int tick_nohz_cpu_down(unsigned int cpu)
> +bool tick_nohz_cpu_hotpluggable(unsigned int cpu)
> {
> /*
> * The tick_do_timer_cpu CPU handles housekeeping duty (unbound
> @@ -540,8 +540,13 @@ static int tick_nohz_cpu_down(unsigned int cpu)
> * CPUs. It must remain online when nohz full is enabled.
> */
> if (tick_nohz_full_running && tick_do_timer_cpu == cpu)
> - return -EBUSY;
> - return 0;
> + return false;
> + return true;
> +}
> +
> +static int tick_nohz_cpu_down(unsigned int cpu)
> +{
> + return tick_nohz_cpu_hotpluggable(cpu) ? 0 : -EBUSY;
> }
>
Yes, this looks better. I will do it this way. Thanks!
- Joel
Powered by blists - more mailing lists