Re: [PATCH 28/32] sched_ext: Implement core-sched support

Andrea Righi
2023-04-20T19:56:23Z

On Fri, Mar 17, 2023 at 11:33:29AM -1000, Tejun Heo wrote:
...
>
> +static int balance_scx(struct rq *rq, struct task_struct *prev,
> + struct rq_flags *rf)
> +{
> + int ret;
> +
> + ret = balance_one(rq, prev, rf, true);
> +
> + /*
> + * When core-sched is enabled, this ops.balance() call will be followed
> + * by put_prev_scx() and pick_task_scx() on this CPU and pick_task_scx()
> + * on the SMT siblings. Balance the siblings too.
> + */
> + if (sched_core_enabled(rq)) {
> + const struct cpumask *smt_mask = cpu_smt_mask(cpu_of(rq));

balance_scx() should be a no-op if CONFIG_SCHED_SMT is undefined or we
may get a build error here.

For example with a minimal ppc64le config (and CONFIG_SCHED_SMT off) I
can reproduce this:

./arch/powerpc/include/asm/smp.h:139:22: error: implicit declaration of function 'cpu_smt_mask'; did you mean 'cpu_cpu_mask'? [-Werror=implicit-function-declaration]

So maybe have something like this (or similar):

#ifdef CONFIG_SCHED_SMT
...
#else
static inline int balance_scx(struct rq *rq, struct task_struct *prev,
struct rq_flags *rf)
{
return 0
}
#endif

Thanks,
-Andrea