lkml.org 
[lkml]   [2023]   [Jan]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] tick/nohz: Fix cpu_is_hotpluggable() by checking with nohz subsystem
On Fri, Jan 20, 2023 at 5:25 PM Frederic Weisbecker <frederic@kernel.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

\
 
 \ /
  Last update: 2023-03-26 23:52    [W:0.157 / U:0.832 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site