On Fri, Apr 13, 2018 at 12:47:45PM +0100, Patrick Bellasi wrote:
> In the past I remember some funny dance in cgroup callbacks when a
> task was terminating (like being moved in the root-rq just before
> exiting). But, as you say, if we always have the task_rq_lock we
> should be safe.

The syscall does the whole:

        task_rq_lock();
        queued = task_on_rq_queued();
        running = task_current();
        if (queued)
                dequeue_task();
        if (running)
                put_prev_task();

        /*
         * task is in invariant state here,
         * muck with it.
         */

        if (queued)
                enqueue_task();
        if (running)
                set_curr_task()
        task_rq_unlock();

pattern; which because C sucks, we've not found a good template for yet.

Without the dequeue/put,enqueue/set you have to jump a few extra hoops.

Reply via email to