lkml.org 
[lkml]   [2023]   [Jan]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    SubjectRe: [PATCH] tick/nohz: Fix cpu_is_hotpluggable() by checking with nohz subsystem
    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;
    }

    void __init tick_nohz_init(void)



    > void __init tick_nohz_init(void)
    > {
    > int cpu, ret;
    > --
    > 2.39.0.246.g2a6d74b583-goog
    >

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