Messages in this thread Patch in this message | | | From | Ricardo Neri <> | Subject | [RFC PATCH 05/23] sched/core: Move is_core_idle() out of fair.c | Date | Fri, 9 Sep 2022 16:11:47 -0700 |
| |
Information about the idle state of the SMT siblings of a core can be used to improve the accuracy of the classification of the current task.
Move is_core_idle() to sched.h to make it available to scheduler_tick().
Cc: Ben Segall <bsegall@google.com> Cc: Daniel Bristot de Oliveira <bristot@redhat.com> Cc: Dietmar Eggemann <dietmar.eggemann@arm.com> Cc: Len Brown <len.brown@intel.com> Cc: Mel Gorman <mgorman@suse.de> Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Tim C. Chen <tim.c.chen@intel.com> Cc: Valentin Schneider <vschneid@redhat.com> Cc: x86@kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com> --- kernel/sched/fair.c | 17 ----------------- kernel/sched/sched.h | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 0089b33ea7b8..2f2a6bb5990d 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -1536,23 +1536,6 @@ struct numa_stats { int idle_cpu; }; -static inline bool is_core_idle(int cpu) -{ -#ifdef CONFIG_SCHED_SMT - int sibling; - - for_each_cpu(sibling, cpu_smt_mask(cpu)) { - if (cpu == sibling) - continue; - - if (!idle_cpu(sibling)) - return false; - } -#endif - - return true; -} - struct task_numa_env { struct task_struct *p; diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 719bdba660e2..2bddedc55ee9 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -3212,6 +3212,23 @@ static inline bool is_per_cpu_kthread(struct task_struct *p) } #endif +static inline bool is_core_idle(int cpu) +{ +#ifdef CONFIG_SCHED_SMT + int sibling; + + for_each_cpu(sibling, cpu_smt_mask(cpu)) { + if (cpu == sibling) + continue; + + if (!idle_cpu(sibling)) + return false; + } +#endif + + return true; +} + extern void swake_up_all_locked(struct swait_queue_head *q); extern void __prepare_to_swait(struct swait_queue_head *q, struct swait_queue *wait); -- 2.25.1
| |