Skip to contentSkip to conversation

sched_ext: Guard cpu_smt_mask() with CONFIG_SCHED_SMT

PATCH Applied Andrea Righi 3 participants 3 messages Mar 22

Subsystems (2)
lore
Share & tools
lore

Andrea Righi

author reviewer
#0 lore raw

PATCH 1/1 sched_ext: Guard cpu_smt_mask() with CONFIG_SCHED_SMT

Wrap cpu_smt_mask() usage with CONFIG_SCHED_SMT to avoid build failures on kernels built without SMT support.

Fixes 2197cecdb02c ("sched_ext: idle: Prioritize idle SMT sibling")
---
 kernel/sched/ext_idle.c | 2 ++
 1 file changed, 2 insertions(+)
kernel/sched/ext_idle.c +2 -0
index d9596427b5aa1..857d8e902b448 100644
@@ -622,6 +622,7 @@ s32 scx_select_cpu_dfl(struct task_struct *p, s32 prev_cpu, u64 wake_flags,
 		goto out_unlock;
 	}
 
+#ifdef CONFIG_SCHED_SMT
 	/*
 	 * Use @prev_cpu's sibling if it's idle.
 	 */
@@ -633,6 +634,7 @@ s32 scx_select_cpu_dfl(struct task_struct *p, s32 prev_cpu, u64 wake_flags,
 				goto out_unlock;
 		}
 	}
+#endif
 
 	/*
 	 * Search for any idle CPU in the same LLC domain.
Signature · 1 line
2.53.0
Reviewed-by on v1 1/1
#1 lore raw

Hi Andrea,

Quoted 34 lines · Andrea Righi

Wrap cpu_smt_mask() usage with CONFIG_SCHED_SMT to avoid build failures on kernels built without SMT support.

Fixes 2197cecdb02c ("sched_ext: idle: Prioritize idle SMT sibling")
---
 kernel/sched/ext_idle.c | 2 ++
 1 file changed, 2 insertions(+)
kernel/sched/ext_idle.c +2 -0
index d9596427b5aa1..857d8e902b448 100644
@@ -622,6 +622,7 @@ s32 scx_select_cpu_dfl(struct task_struct *p, s32 prev_cpu, u64 wake_flags,
 		goto out_unlock;
 	}
 
+#ifdef CONFIG_SCHED_SMT
 	/*
 	 * Use @prev_cpu's sibling if it's idle.
 	 */
@@ -633,6 +634,7 @@ s32 scx_select_cpu_dfl(struct task_struct *p, s32 prev_cpu, u64 wake_flags,
 				goto out_unlock;
 		}
 	}
+#endif
 
 	/*
 	 * Search for any idle CPU in the same LLC domain.
Signature · 1 line
2.53.0

Tested with the robot's config and the error is gone.

Signature · 2 lines
Thanks,
Cheng-Yang