lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 20 Nov 2018 16:33:11 +0000
From:   Roman Gushchin <guro@...com>
To:     Tejun Heo <tj@...nel.org>
CC:     Roman Gushchin <guroan@...il.com>, Oleg Nesterov <oleg@...hat.com>,
        "cgroups@...r.kernel.org" <cgroups@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Kernel Team <Kernel-team@...com>
Subject: Re: [PATCH v3 4/7] cgroup: cgroup v2 freezer

On Tue, Nov 20, 2018 at 08:25:29AM -0800, Tejun Heo wrote:
> 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?

It does! Just below these lines:

	/*
	 * If the task isn't in the desired state, force it to it.
	 */
	if (task->frozen != test_bit(CGRP_FREEZE, &dst->flags))
		cgroup_freeze_task(task, test_bit(CGRP_FREEZE, &dst->flags));


It's also covered by the 5th kselftest.

Thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ