Re: [PATCH 6/7 v4] sched/fair: trigger the update of blocked load on newly idle cpu

From: Qais Yousef
Date: Fri Mar 05 2021 - 08:53:39 EST


On 02/24/21 14:30, Vincent Guittot wrote:
> +/*
> + * Check if we need to run the ILB for updating blocked load before entering
> + * idle state.
> + */
> +void nohz_run_idle_balance(int cpu)
> +{
> + unsigned int flags;
> +
> + flags = atomic_fetch_andnot(NOHZ_NEWILB_KICK, nohz_flags(cpu));
> +
> + /*
> + * Update the blocked load only if no SCHED_SOFTIRQ is about to happen
> + * (ie NOHZ_STATS_KICK set) and will do the same.
> + */
> + if ((flags == NOHZ_NEWILB_KICK) && !need_resched())
> + _nohz_idle_balance(cpu_rq(cpu), NOHZ_STATS_KICK, CPU_IDLE);
> +}

nit: need_resched() implies this_cpu, but the function signature implies you
could operate on any CPU. Do need_resched() outside this function or make
the function read smp_processor_id() itself without taking an arg?

Thanks

--
Qais Yousef