[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120116123821.GA25918@shutemov.name>
Date: Mon, 16 Jan 2012 14:38:21 +0200
From: "Kirill A. Shutemov" <kirill@...temov.name>
To: Frederic Weisbecker <fweisbec@...il.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
Glauber Costa <glommer@...il.com>,
Cgroups <cgroups@...r.kernel.org>,
Daniel J Walsh <dwalsh@...hat.com>,
"Daniel P. Berrange" <berrange@...hat.com>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
Max Kellermann <mk@...all.com>,
Mandeep Singh Baines <msb@...omium.org>,
Paul Menage <paul@...lmenage.org>,
Li Zefan <lizf@...fujitsu.com>,
Johannes Weiner <hannes@...xchg.org>,
Aditya Kali <adityakali@...gle.com>,
Oleg Nesterov <oleg@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Kay Sievers <kay.sievers@...y.org>,
Tim Hockin <thockin@...kin.org>, Tejun Heo <tj@...nel.org>,
Containers <containers@...ts.linux-foundation.org>
Subject: Re: [PATCH 8/8] cgroups: Add a task counter subsystem
On Fri, Jan 13, 2012 at 07:14:00PM +0100, Frederic Weisbecker wrote:
> Add a new subsystem to limit the number of running tasks,
> similar to the NR_PROC rlimit but in the scope of a cgroup.
>
> The user can set an upper bound limit that is checked every
> time a task forks in a cgroup or is moved into a cgroup
> with that subsystem binded.
>
> The primary goal is to protect against forkbombs that explode
> inside a container. The traditional NR_PROC rlimit is not
> efficient in that case because if we run containers in parallel
> under the same user, one of these could starve all the others
> by spawning a high number of tasks close to the user wide limit.
>
> This is a prevention against forkbombs, so it's not deemed to
> cure the effects of a forkbomb when the system is in a state
> where it's not responsive. It's aimed at preventing from ever
> reaching that state and stop the spreading of tasks early.
> While defining the limit on the allowed number of tasks, it's
> up to the user to find the right balance between the resource
> its containers may need and what it can afford to provide.
>
> As it's totally dissociated from the rlimit NR_PROC, both
> can be complementary: the cgroup task counter can set an upper
> bound per container and the rlmit can be an upper bound on the
> overall set of containers.
>
> Also this subsystem can be used to kill all the tasks in a cgroup
> without races against concurrent forks, by setting the limit of
> tasks to 0, any further forks can be rejected. This is a good
> way to kill a forkbomb in a container, or simply kill any container
> without the need to retry an unbound number of times.
>
> Signed-off-by: Frederic Weisbecker <fweisbec@...il.com>
> Cc: Paul Menage <paul@...lmenage.org>
> Cc: Li Zefan <lizf@...fujitsu.com>
> Cc: Johannes Weiner <hannes@...xchg.org>
> Cc: Aditya Kali <adityakali@...gle.com>
> Cc: Oleg Nesterov <oleg@...hat.com>
> Cc: Andrew Morton <akpm@...ux-foundation.org>
> Cc: Kay Sievers <kay.sievers@...y.org>
> Cc: Tim Hockin <thockin@...kin.org>
> Cc: Tejun Heo <tj@...nel.org>
> Cc: Kirill A. Shutemov <kirill@...temov.name>
> Cc: Containers <containers@...ts.linux-foundation.org>
Acked-by: Kirill A. Shutemov <kirill@...temov.name>
--
Kirill A. Shutemov
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists