mirror_ubuntu-kernels/include/linux/sched
Ingo Molnar 38d707c54d sched/balancing: Change 'enum cpu_idle_type' to have more natural definitions
The cpu_idle_type enum has the confusingly inverted property
that 'not idle' is 1, and 'idle' is '0'.

This resulted in a number of unnecessary complications in the code.

Reverse the order, remove the CPU_NOT_IDLE type, and convert
all code to a natural boolean form.

It's much more readable:

  -       enum cpu_idle_type idle = this_rq->idle_balance ?
  -                                               CPU_IDLE : CPU_NOT_IDLE;
  -
  +       enum cpu_idle_type idle = this_rq->idle_balance;

  --------------------------------

  -       if (env->idle == CPU_NOT_IDLE || !busiest->sum_nr_running)
  +       if (!env->idle || !busiest->sum_nr_running)

  --------------------------------

And gets rid of the double negation in these usages:

  -               if (env->idle != CPU_NOT_IDLE && env->src_rq->nr_running <= 1)
  +               if (env->idle && env->src_rq->nr_running <= 1)

Furthermore, this makes code much more obvious where there's
differentiation between CPU_IDLE and CPU_NEWLY_IDLE.

Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Valentin Schneider <vschneid@redhat.com>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Cc: "Gautham R. Shenoy" <gautham.shenoy@amd.com>
Link: https://lore.kernel.org/r/20240308105901.1096078-4-mingo@kernel.org
2024-03-12 11:03:40 +01:00
..
affinity.h
autogroup.h
clock.h
cond_resched.h
coredump.h
cpufreq.h
cputime.h
deadline.h
debug.h
hotplug.h
idle.h sched/balancing: Change 'enum cpu_idle_type' to have more natural definitions 2024-03-12 11:03:40 +01:00
init.h
isolation.h cgroup/cpuset: Include isolated cpuset CPUs in cpu_is_isolated() check 2023-12-06 09:37:28 -10:00
jobctl.h
loadavg.h
mm.h
nohz.h
numa_balancing.h Many singleton patches against the MM code. The patch series which are 2023-11-02 19:38:47 -10:00
posix-timers.h
prio.h
rseq_api.h
rt.h
sd_flags.h sched/topology: Rename SD_SHARE_PKG_RESOURCES to SD_SHARE_LLC 2024-02-28 15:43:17 +01:00
signal.h pidfd: exit: kill the no longer used thread_group_exited() 2024-02-06 14:02:51 +01:00
smt.h
stat.h
sysctl.h
task_flags.h
task_stack.h task_stack.h: add missing include 2023-12-20 19:26:30 -05:00
task.h header cleanups for 6.8 2024-01-10 16:43:55 -08:00
thread_info_api.h
topology.h Scheduler changes for v6.9: 2024-03-11 18:45:16 -07:00
types.h
user.h
vhost_task.h
wake_q.h
xacct.h