Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753498AbbKJPZh (ORCPT ); Tue, 10 Nov 2015 10:25:37 -0500 Received: from mail-io0-f171.google.com ([209.85.223.171]:32862 "EHLO mail-io0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752707AbbKJPZf (ORCPT ); Tue, 10 Nov 2015 10:25:35 -0500 MIME-Version: 1.0 X-Originating-IP: [122.106.150.15] In-Reply-To: <144716440621.20175.1000688899886388119.stgit@rabbit.intern.cm-ag> References: <144716440621.20175.1000688899886388119.stgit@rabbit.intern.cm-ag> Date: Wed, 11 Nov 2015 02:25:34 +1100 Message-ID: Subject: Re: [PATCH] cgroup_pids: add fork limit From: Aleksa Sarai To: Max Kellermann Cc: Tejun Heo , cgroups@vger.kernel.org, lizefan@huawei.com, Johannes Weiner , max@duempel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1830 Lines: 39 Hi Max, I agree with what Tejun said, I just wanted to make a few specific points: > This patch introduces a new setting called "fork_remaining". When > positive, each successful fork decrements the value, and once it > reaches zero, no further forking is allowed, no matter how many of > those processes are still alive. The special value "unlimited" > disables the fork limit. I don't understand *why* you want this. cgroups are meant to deal with the accounting of *legitimate resources*, and I don't see how "the number of forks ever in a given cgroup" is a reasonable resource. Not to mention that it doesn't make sense IMO to make a limit that gets smaller over time when processes that have died and been freed > The goal of this limit is to have another safeguard against fork > bombs. It gives processes a chance to set up their child processes / > threads, but will be stopped once they attempt to waste resources by > continuously exiting and cloning new processes. This can be useful > for short-lived processes such as CGI programs. Processes don't "use up resources" after they've died and been freed (which is dealt with inside PIDs). Yes, lots of small processes that die quickly could (in principle) make hard work for the scheduler, but I don't see how "time spent scheduling in general" is a resource... Fork bombs aren't bad because they cause a lot of fork()s, they're bad because the *create a bunch of processes that use up memory*, which happens because they call fork() a bunch of times and **don't exit()**. -- Aleksa Sarai (cyphar) www.cyphar.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/