Re: [RFC PATCH 2/3] sched/cpuset: Keep track of SCHED_DEADLINE tasks in cpusets

From: Dietmar Eggemann
Date: Wed Mar 22 2023 - 09:19:26 EST


On 15/03/2023 18:14, Juri Lelli wrote:
> On 15/03/23 11:46, Waiman Long wrote:
>>
>> On 3/15/23 08:18, Juri Lelli wrote:

[...]

>>> @@ -2472,6 +2492,11 @@ static int cpuset_can_attach(struct cgroup_taskset *tset)
>>> ret = security_task_setscheduler(task);
>>> if (ret)
>>> goto out_unlock;
>>> +
>>> + if (dl_task(task)) {
>>> + cs->nr_deadline_tasks++;
>>> + cpuset_attach_old_cs->nr_deadline_tasks--;
>>> + }
>>> }
>>
>> Any one of the tasks in the cpuset can cause the test to fail and abort the
>> attachment. I would suggest that you keep a deadline task transfer count in
>> the loop and then update cs and cpouset_attach_old_cs only after all the
>> tasks have been iterated successfully.
>
> Right, Dietmar I think commented pointing out something along these
> lines. Think though we already have this problem with current
> task_can_attach -> dl_cpu_busy which reserves bandwidth for each tasks
> in the destination cs. Will need to look into that. Do you know which
> sort of operation would move multiple tasks at once?

Moving the process instead of the individual tasks makes
cpuset_can_attach() have to deal with multiple tasks.

# ps2 | grep DLN
1614 1615 140 0 - DLN thread0-0
1614 1616 140 0 - DLN thread0-1
1614 1617 140 0 - DLN thread0-2

# echo 1614 > /sys/fs/cgroup/cpuset/cs2/cgroup.procs