Module Name: src
Committed By: jym
Date: Fri Feb 26 18:47:13 UTC 2010
Modified Files:
src/sys/kern: kern_proc.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.162 -r1.163 src/sys/kern/kern_proc.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/kern/kern_proc.c
diff -u src/sys/kern/kern_proc.c:1.162 src/sys/kern/kern_proc.c:1.163
--- src/sys/kern/kern_proc.c:1.162 Tue Feb 23 22:19:27 2010
+++ src/sys/kern/kern_proc.c Fri Feb 26 18:47:13 2010
@@ -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 @@
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;