From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754718Ab1JKNlZ (ORCPT ); Tue, 11 Oct 2011 09:41:25 -0400 Received: from mail-ww0-f44.google.com ([74.125.82.44]:41744 "EHLO mail-ww0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751827Ab1JKNlX (ORCPT ); Tue, 11 Oct 2011 09:41:23 -0400 Date: Tue, 11 Oct 2011 15:41:14 +0200 From: Frederic Weisbecker To: "Kirill A. Shutemov" Cc: Andrew Morton , LKML , Paul Menage , Li Zefan , Johannes Weiner , Aditya Kali , Oleg Nesterov , Kay Sievers , Tim Hockin , Tejun Heo , Containers Subject: Re: [PATCH 10/10] cgroups: Add a task counter subsystem Message-ID: <20111011134106.GB16777@somewhere.redhat.com> References: <1317668832-10784-1-git-send-email-fweisbec@gmail.com> <1317668832-10784-11-git-send-email-fweisbec@gmail.com> <20111006092348.GB28820@shutemov.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20111006092348.GB28820@shutemov.name> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 06, 2011 at 12:23:48PM +0300, Kirill A. Shutemov wrote: > On Mon, Oct 03, 2011 at 09:07:12PM +0200, 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 > > Acked-by: Kirill A. Shutemov Thanks a lot for your acks Kirill!