Re: [RFC PATCH v7 08/23] sched: Add core wide task selection and scheduling.

From: Vineeth Pillai
Date: Fri Aug 28 2020 - 18:02:33 EST




On 8/28/20 4:51 PM, Peter Zijlstra wrote:
cpumask_weigt() is fairly expensive, esp. for something that should
'never' happen.

What exactly is the race here?

We'll update the cpu_smt_mask() fairly early in secondary bringup, but
where does it become a problem?

The moment the new thread starts scheduling it'll block on the common
rq->lock and then it'll cycle task_seq and do a new pick.

So where do things go side-ways?
During hotplug stress test, we have noticed that while a sibling is in
pick_next_task, another sibling can go offline or come online. What
we have observed is smt_mask get updated underneath us even if
we hold the lock. From reading the code, looks like we don't hold the
rq lock when the mask is updated. This extra logic was to take care of that.

Can we please split out this hotplug 'fix' into a separate patch with a
coherent changelog.
Sorry about this. I had posted this as separate patches in v6 list,
but merged it for v7. Will split it and have details about the fix in
next iteration.

Thanks,
Vineeth