Change RSS (resident set size) limit. Instead of setting it arbitrarily
to the total free memory available to the system, use the smallest value between VM_MAXUSER_ADDRESS and total free memory (having a RSS limit bigger than VM_MAXUSER_ADDRESS has no real meaning). Fix a possible int overflow when ptoa(uvmexp.free) is bigger than 4GB with a 32 bits vaddr_t. This change is similar to the one made in rev 1.144 of uvm/uvm_glue.c.
This commit is contained in:
parent
933c70b5e1
commit
cbdb1f8831
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: kern_proc.c,v 1.162 2010/02/23 22:19:27 darran Exp $ */
|
||||
/* $NetBSD: kern_proc.c,v 1.163 2010/02/26 18:47:13 jym Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2006, 2007, 2008 The NetBSD Foundation, Inc.
|
||||
|
@ -62,7 +62,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.162 2010/02/23 22:19:27 darran Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.163 2010/02/26 18:47:13 jym Exp $");
|
||||
|
||||
#include "opt_kstack.h"
|
||||
#include "opt_maxuprc.h"
|
||||
|
@ -418,7 +418,7 @@ proc0_init(void)
|
|||
limit0.pl_rlimit[RLIMIT_NPROC].rlim_cur =
|
||||
maxproc < maxuprc ? maxproc : maxuprc;
|
||||
|
||||
lim = ptoa(uvmexp.free);
|
||||
lim = MIN(VM_MAXUSER_ADDRESS, ctob((rlim_t)uvmexp.free));
|
||||
limit0.pl_rlimit[RLIMIT_RSS].rlim_max = lim;
|
||||
limit0.pl_rlimit[RLIMIT_MEMLOCK].rlim_max = lim;
|
||||
limit0.pl_rlimit[RLIMIT_MEMLOCK].rlim_cur = lim / 3;
|
||||
|
|
Loading…
Reference in New Issue