Re: [RFC PATCH 12/13] sched: cgroup tagging interface for core scheduling

Vineeth Remanan Pillai
2020-06-26T15:06:48Z

On Wed, Mar 4, 2020 at 12:00 PM vpillai <vpillai@digitalocean.com> wrote:
>
>
> Marks all tasks in a cgroup as matching for core-scheduling.
>
> A task will need to be moved into the core scheduler queue when the cgroup
> it belongs to is tagged to run with core scheduling. Similarly the task
> will need to be moved out of the core scheduler queue when the cgroup
> is untagged.
>
> Also after we forked a task, its core scheduler queue's presence will
> need to be updated according to its new cgroup's status.
>
This came up during a private discussion with Joel and thanks to
him for bringing this up! Details below..

> @@ -7910,7 +7986,12 @@ static void cpu_cgroup_fork(struct task_struct *task)
> rq = task_rq_lock(task, &rf);
>
> update_rq_clock(rq);
> + if (sched_core_enqueued(task))
> + sched_core_dequeue(rq, task);
A newly created task will not be enqueued and hence do we need this
here?

> sched_change_group(task, TASK_SET_GROUP);
> + if (sched_core_enabled(rq) && task_on_rq_queued(task) &&
> + task->core_cookie)
> + sched_core_enqueue(rq, task);
>
Do we need this here? Soon after this, wake_up_new_task() is called
which will ultimately call enqueue_task() and adds the task to the
coresched rbtree. So we will be trying to enqueue twice. Also, this
code will not really enqueue, because task_on_rq_queued() would
return false at this point(activate_task is not yet called for this
new task).

I am not sure if I missed any other code path reaching here that
does not proceed with wake_up_new_task().Please let me know, if I
missed anything here.

Thanks,
Vineeth