Re: [PATCH -tip 22/32] sched: Split the cookie and setup per-task cookie on fork

From: Peter Zijlstra
Date: Wed Dec 02 2020 - 02:56:41 EST


On Tue, Dec 01, 2020 at 10:36:18PM -0800, Josh Don wrote:
> On Tue, Dec 1, 2020 at 11:35 AM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> >
> > So I don't think that later patch is right... That is, it works, but
> > afaict it's massive overkill.
> >
> > COOKIE_CMP_RETURN(task_cookie);
> > COOKIE_CMP_RETURN(group_cookie);
> > COOKIE_CMP_RETURN(color);
> >
> > So if task_cookie matches, we consider group_cookie, if that matches we
> > consider color.
> >
> > Now, afaict that's semantically exactly the same as just using the
> > narrowest cookie. That is, use the task cookie if there is, and then,
> > walking the cgroup hierarchy (up) pick the first cgroup cookie.
> >
> > (I don't understand the color thing, but lets have that discussion in
> > that subthread)
> >
> > Which means you only need a single active cookie field.
> >
> > IOW, you're just making things complicated and expensive.
> >
>
> For the per-task interface, I believe we still want to prevent two
> tasks that share a task cookie from sharing an overall cookie if they
> are in two separately tagged groups (Joel please correct me if I'm
> mistaken there). That's why in Joel's older patch, the overall cookie
> was a combination of the task and group cookies. My concern about
> that was the potential cookie collision.

Then disallow sharing a task cookie when the tasks are in different
cgroups or disallow cgroup movement when they share a cookie.