Re: [PATCH 2/6] sched: tagging interface for core scheduling

From: Chris Hyser
Date: Mon Mar 22 2021 - 14:39:11 EST




On 3/22/21 2:33 PM, Peter Zijlstra wrote:
On Mon, Mar 22, 2021 at 01:57:48PM -0400, Chris Hyser wrote:
On 3/20/21 11:46 AM, Peter Zijlstra wrote:
On Fri, Mar 19, 2021 at 04:32:49PM -0400, Joel Fernandes (Google) wrote:
From: Josh Don <joshdon@xxxxxxxxxx>

Adds per-task and per-cgroup interfaces for specifying which tasks can
co-execute on adjacent SMT hyperthreads via core scheduling.

The per-task interface hooks are implemented here, but are not currently
used. The following patch adds a prctl interface which then takes
advantage of these.

The cgroup interface can be used to toggle a unique cookie value for all
descendent tasks, preventing these tasks from sharing with any others.
See Documentation/admin-guide/hw-vuln/core-scheduling.rst for a full
rundown.

One important property of this interface is that neither the per-task
nor the per-cgroup setting overrides the other. For example, if two
tasks are in different cgroups, and one or both of the cgroups is tagged
using the per-cgroup interface, then these tasks cannot share, even if
they use the per-task interface to attempt to share with one another.

The above is implemented by making the overall core scheduling cookie a
compound structure, containing both a task-level cookie and a
group-level cookie. Two tasks will only be allowed to share if all
fields of their respective cookies match.

Core scheduler has extra overhead. Enable it only for machines with
more than one SMT hardware thread.

Oh man.. I'd soooo hoped to first see the simple task interface and then
see the cgroup patch on top of that... I'll see if I can flip them
myself (on monday).

Peter, given we need to rebase this and we have some cleanup, we can go
ahead and flip the order if you have not yet done so yet.

I didn't get around to it yet :/ So yes, please! Also can you then split
the selftest thingies?

Will do.

-chrish