Re: [RFC PATCH v2 12/17] sched: A quick and dirty cgroup tagging interface

From: Peter Zijlstra
Date: Fri Apr 26 2019 - 10:13:44 EST


On Thu, Apr 25, 2019 at 10:26:53AM -0400, Phil Auld wrote:
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index e8e5f26db052..b312ea1e28a4 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -7541,6 +7541,9 @@ static int cpu_core_tag_write_u64(struct cgroup_subsys_state *css, struct cftype
> if (val > 1)
> return -ERANGE;
>
> + if (num_online_cpus() <= 1)
> + return -EINVAL;

We actually know if there SMT on the system or not, which is much better
indication still:

if (!static_branch_likely(&sched_smt_present))
return -EINVAL;

> if (tg->tagged == !!val)
> return 0;
>
>
>
>
> --