Commit e705968d authored by Lin Shengwang's avatar Lin Shengwang Committed by Peter Zijlstra

sched/core: Fix comparison in sched_group_cookie_match()

In commit 97886d9d ("sched: Migration changes for core scheduling"),
sched_group_cookie_match() was added to help determine if a cookie
matches the core state.

However, while it iterates the SMT group, it fails to actually use the
RQ for each of the CPUs iterated, use cpu_rq(cpu) instead of rq to fix
things.

Fixes: 97886d9d ("sched: Migration changes for core scheduling")
Signed-off-by: default avatarLin Shengwang <linshengwang1@huawei.com>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20221008022709.642-1-linshengwang1@huawei.com
parent 9abf2313
...@@ -1182,6 +1182,14 @@ static inline bool is_migration_disabled(struct task_struct *p) ...@@ -1182,6 +1182,14 @@ static inline bool is_migration_disabled(struct task_struct *p)
#endif #endif
} }
DECLARE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues);
#define cpu_rq(cpu) (&per_cpu(runqueues, (cpu)))
#define this_rq() this_cpu_ptr(&runqueues)
#define task_rq(p) cpu_rq(task_cpu(p))
#define cpu_curr(cpu) (cpu_rq(cpu)->curr)
#define raw_rq() raw_cpu_ptr(&runqueues)
struct sched_group; struct sched_group;
#ifdef CONFIG_SCHED_CORE #ifdef CONFIG_SCHED_CORE
static inline struct cpumask *sched_group_span(struct sched_group *sg); static inline struct cpumask *sched_group_span(struct sched_group *sg);
...@@ -1269,7 +1277,7 @@ static inline bool sched_group_cookie_match(struct rq *rq, ...@@ -1269,7 +1277,7 @@ static inline bool sched_group_cookie_match(struct rq *rq,
return true; return true;
for_each_cpu_and(cpu, sched_group_span(group), p->cpus_ptr) { for_each_cpu_and(cpu, sched_group_span(group), p->cpus_ptr) {
if (sched_core_cookie_match(rq, p)) if (sched_core_cookie_match(cpu_rq(cpu), p))
return true; return true;
} }
return false; return false;
...@@ -1384,14 +1392,6 @@ static inline void update_idle_core(struct rq *rq) ...@@ -1384,14 +1392,6 @@ static inline void update_idle_core(struct rq *rq)
static inline void update_idle_core(struct rq *rq) { } static inline void update_idle_core(struct rq *rq) { }
#endif #endif
DECLARE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues);
#define cpu_rq(cpu) (&per_cpu(runqueues, (cpu)))
#define this_rq() this_cpu_ptr(&runqueues)
#define task_rq(p) cpu_rq(task_cpu(p))
#define cpu_curr(cpu) (cpu_rq(cpu)->curr)
#define raw_rq() raw_cpu_ptr(&runqueues)
#ifdef CONFIG_FAIR_GROUP_SCHED #ifdef CONFIG_FAIR_GROUP_SCHED
static inline struct task_struct *task_of(struct sched_entity *se) static inline struct task_struct *task_of(struct sched_entity *se)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment