Module Name:    src
Committed By:   jym
Date:           Thu Feb 25 23:10:49 UTC 2010

Modified Files:
        src/sys/uvm: uvm_glue.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.

Reviewed by bou...@.

See also http://mail-index.netbsd.org/tech-kern/2010/02/24/msg007395.html


To generate a diff of this commit:
cvs rdiff -u -r1.143 -r1.144 src/sys/uvm/uvm_glue.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/uvm/uvm_glue.c
diff -u src/sys/uvm/uvm_glue.c:1.143 src/sys/uvm/uvm_glue.c:1.144
--- src/sys/uvm/uvm_glue.c:1.143	Thu Dec 17 01:25:11 2009
+++ src/sys/uvm/uvm_glue.c	Thu Feb 25 23:10:49 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_glue.c,v 1.143 2009/12/17 01:25:11 rmind Exp $	*/
+/*	$NetBSD: uvm_glue.c,v 1.144 2010/02/25 23:10:49 jym Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_glue.c,v 1.143 2009/12/17 01:25:11 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_glue.c,v 1.144 2010/02/25 23:10:49 jym Exp $");
 
 #include "opt_kgdb.h"
 #include "opt_kstack.h"
@@ -407,7 +407,8 @@
 	p->p_rlimit[RLIMIT_DATA].rlim_max = maxdmap;
 	p->p_rlimit[RLIMIT_AS].rlim_cur = RLIM_INFINITY;
 	p->p_rlimit[RLIMIT_AS].rlim_max = RLIM_INFINITY;
-	p->p_rlimit[RLIMIT_RSS].rlim_cur = ptoa(uvmexp.free);
+	p->p_rlimit[RLIMIT_RSS].rlim_cur = MIN(
+	    VM_MAXUSER_ADDRESS, ctob((rlim_t)uvmexp.free));
 }
 
 /*

Reply via email to