Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm Change RSS (resident set size) limit. Instead of set...



details:   https://anonhg.NetBSD.org/src/rev/44e9a5725613
branches:  trunk
changeset: 752433:44e9a5725613
user:      jym <jym%NetBSD.org@localhost>
date:      Thu Feb 25 23:10:49 2010 +0000

description:
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 bouyer@.

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

diffstat:

 sys/uvm/uvm_glue.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r f41e80011427 -r 44e9a5725613 sys/uvm/uvm_glue.c
--- a/sys/uvm/uvm_glue.c        Thu Feb 25 23:01:48 2010 +0000
+++ b/sys/uvm/uvm_glue.c        Thu Feb 25 23:10:49 2010 +0000
@@ -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));
 }
 
 /*



Home | Main Index | Thread Index | Old Index