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

From: Phil Auld
Date: Fri Apr 26 2019 - 10:19:25 EST


On Fri, Apr 26, 2019 at 04:13:07PM +0200 Peter Zijlstra wrote:
> 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;
> >
> >
> >
> >
> > --

Yeah, I thought there was probably a better check.

Thanks!

--