From owner-freebsd-hackers Sat Feb 4 23:58:10 1995 Return-Path: hackers-owner Received: (from root@localhost) by freefall.cdrom.com (8.6.9/8.6.6) id XAA08878 for hackers-outgoing; Sat, 4 Feb 1995 23:58:10 -0800 Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.34]) by freefall.cdrom.com (8.6.9/8.6.6) with ESMTP id XAA08861 for ; Sat, 4 Feb 1995 23:58:02 -0800 Received: (from bde@localhost) by godzilla.zeta.org.au (8.6.9/8.6.9) id SAA12171; Sun, 5 Feb 1995 18:56:38 +1100 Date: Sun, 5 Feb 1995 18:56:38 +1100 From: Bruce Evans Message-Id: <199502050756.SAA12171@godzilla.zeta.org.au> To: elh@p5.spnet.com, freebsd-hackers@FreeBSD.org Subject: Re: kernel limits Cc: elh@spnet.com Sender: hackers-owner@FreeBSD.org Precedence: bulk > 1) bump /usr/src/sys/sys/param.h:MAXSYMLNK from 8 to > something reasonable, such as 32. This limit should probably be changeable using sysctl. > 2) bump up CHILD_MAX from 40 to something reasonable, > say 128. > why: i've compiled large software systems that spawn > a deep series of subshells and (then do final makes) and > these can frequently run into MAXUPRC, which is set to > CHILD_MAX. also, simulating make-called-tools from other CHILD_MAX is bogus. It is only used to report a bogus limit to applications in and to initialize MAXUPRC. MAXUPRC is only the _initial_ value for the _current_ (soft) process limit. The actual limit is the _hard_ process limit, which is initially `maxproc' but can be reduced by applications. `maxproc' itself can be changed using `sysctl -w kern.maxproc=whatever'. Applications that need a larger limit should use setrlimit() to increase their soft limit. Systems that need a larger limit should use sysctl in /etc/rc.local to increase `maxproc'. There seem to be some coherency problems in practice. Changing limits with sysctl has no effect on previously set rlimits. This seems best - a process that has used getrlimit() or setrlimit should not have the limits changed beneath it. Rlimits are inherited, so changing limits with sysctl has on effect on the rlimits for subsequently forked processes, unless setrlimit() is used; however, the maxproc limit is enforced as well as rlimit_cur[RLIMIT_NPROC], so the unchanged rlimits may be too large. Process limits apply to all processes with the same uid. This allows a deeply nested process to screw up top-level processes by increasing its process limit and forking a lot of processes - the limit for top-level processes isn't changed so they may not be able to fork. Bruce