tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

maxlwp



hi,

i have some questions about maxlwp stuff.

- unlike kern.maxproc which restricts the total number of processes in
a system, kern.maxlwp's sole purpose is to restrict setrlimit.  is it right?
if so, why the usual kauth check to prevent raising a hard limit is not
enough?

- default cpu_maxlwp() returns 2048.  what's the rationale of this
small value?  IMO a better default is "unlimited".

- i want login.conf support for this.  is the attached patch ok?

YAMAMOTO Takashi
Index: lib/libutil/login_cap.c
===================================================================
RCS file: /cvsroot/src/lib/libutil/login_cap.c,v
retrieving revision 1.30
diff -u -p -r1.30 login_cap.c
--- lib/libutil/login_cap.c     7 Apr 2012 16:16:34 -0000       1.30
+++ lib/libutil/login_cap.c     29 Mar 2013 14:09:51 -0000
@@ -420,6 +420,7 @@ static struct {
        { RLIMIT_RSS,           R_CSIZE, "memoryuse", },
        { RLIMIT_MEMLOCK,       R_CSIZE, "memorylocked", },
        { RLIMIT_NPROC,         R_CNUMB, "maxproc", },
+       { RLIMIT_NTHR,          R_CNUMB, "maxthread", },
        { RLIMIT_NOFILE,        R_CNUMB, "openfiles", },
        { RLIMIT_CORE,          R_CSIZE, "coredumpsize", },
        { RLIMIT_SBSIZE,        R_CSIZE, "sbsize", },
Index: share/man/man5/login.conf.5
===================================================================
RCS file: /cvsroot/src/share/man/man5/login.conf.5,v
retrieving revision 1.26
diff -u -p -r1.26 login.conf.5
--- share/man/man5/login.conf.5 30 Apr 2012 11:07:28 -0000      1.26
+++ share/man/man5/login.conf.5 29 Mar 2013 14:09:52 -0000
@@ -167,6 +167,11 @@ Number of login attempts after which to 
 Maximum number of processes.
 .\"
 .sp
+.It Sy maxthread Ta number Ta "" Ta
+Maximum number of threads.
+First thread of each process are not counted against this.
+.\"
+.sp
 .It Sy memorylocked Ta size Ta "" Ta
 Maximum locked in core memory size limit.
 .\"


Home | Main Index | Thread Index | Old Index