Skip to content

Commit e705968

Browse files
Lin ShengwangPeter Zijlstra
authored andcommitted
sched/core: Fix comparison in sched_group_cookie_match()
In commit 97886d9 ("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: 97886d9 ("sched: Migration changes for core scheduling") Signed-off-by: Lin Shengwang <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 9abf231 commit e705968

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

kernel/sched/sched.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,6 +1182,14 @@ static inline bool is_migration_disabled(struct task_struct *p)
11821182
#endif
11831183
}
11841184

1185+
DECLARE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues);
1186+
1187+
#define cpu_rq(cpu) (&per_cpu(runqueues, (cpu)))
1188+
#define this_rq() this_cpu_ptr(&runqueues)
1189+
#define task_rq(p) cpu_rq(task_cpu(p))
1190+
#define cpu_curr(cpu) (cpu_rq(cpu)->curr)
1191+
#define raw_rq() raw_cpu_ptr(&runqueues)
1192+
11851193
struct sched_group;
11861194
#ifdef CONFIG_SCHED_CORE
11871195
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,
12691277
return true;
12701278

12711279
for_each_cpu_and(cpu, sched_group_span(group), p->cpus_ptr) {
1272-
if (sched_core_cookie_match(rq, p))
1280+
if (sched_core_cookie_match(cpu_rq(cpu), p))
12731281
return true;
12741282
}
12751283
return false;
@@ -1384,14 +1392,6 @@ static inline void update_idle_core(struct rq *rq)
13841392
static inline void update_idle_core(struct rq *rq) { }
13851393
#endif
13861394

1387-
DECLARE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues);
1388-
1389-
#define cpu_rq(cpu) (&per_cpu(runqueues, (cpu)))
1390-
#define this_rq() this_cpu_ptr(&runqueues)
1391-
#define task_rq(p) cpu_rq(task_cpu(p))
1392-
#define cpu_curr(cpu) (cpu_rq(cpu)->curr)
1393-
#define raw_rq() raw_cpu_ptr(&runqueues)
1394-
13951395
#ifdef CONFIG_FAIR_GROUP_SCHED
13961396
static inline struct task_struct *task_of(struct sched_entity *se)
13971397
{

0 commit comments

Comments
 (0)