lkml.org 
[lkml]   [2018]   [Nov]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v3 4/7] cgroup: cgroup v2 freezer
    On Fri, Nov 16, 2018 at 04:38:27PM -0800, Roman Gushchin wrote:
    > +void cgroup_freezer_migrate_task(struct task_struct *task,
    > + struct cgroup *src, struct cgroup *dst)
    > +{
    > + lockdep_assert_held(&css_set_lock);
    > +
    > + /*
    > + * Kernel threads are not supposed to be frozen at all.
    > + */
    > + if (task->flags & PF_KTHREAD)
    > + return;
    > +
    > + /*
    > + * Adjust counters of freezing and frozen tasks.
    > + */
    > + if (test_bit(CGRP_FREEZE, &src->flags)) {
    > + src->freezer.nr_tasks_to_freeze--;
    > + WARN_ON_ONCE(src->freezer.nr_tasks_to_freeze < 0);
    > + }
    > +
    > + /*
    > + * If the task is frozen, let's bump nr_tasks_to_freeze even
    > + * if the target cgroup isn't frozen: the counter will be decreased
    > + * in cgroup_leave_frozen().
    > + */
    > + if (test_bit(CGRP_FREEZE, &dst->flags) || task->frozen)
    > + dst->freezer.nr_tasks_to_freeze++;
    > +
    > + if (task->frozen) {
    > + src->freezer.nr_frozen_tasks--;
    > + dst->freezer.nr_frozen_tasks++;
    > + WARN_ON_ONCE(src->freezer.nr_frozen_tasks < 0);
    > + WARN_ON_ONCE(dst->freezer.nr_frozen_tasks >
    > + dst->freezer.nr_tasks_to_freeze);
    > + }

    If a non-frozen task is being moved into a frozen cgroup, shouldn't
    that also trigger frozen state update?

    Thanks.

    --
    tejun

    \
     
     \ /
      Last update: 2018-11-20 17:25    [W:6.577 / U:0.020 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site