Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/e9d4ab4894b9
branches:  trunk
changeset: 752457:e9d4ab4894b9
user:      jym <jym%NetBSD.org@localhost>
date:      Fri Feb 26 18:47:13 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.

This change is similar to the one made in rev 1.144 of uvm/uvm_glue.c.

diffstat:

 sys/kern/kern_proc.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 381d40ebe980 -r e9d4ab4894b9 sys/kern/kern_proc.c
--- a/sys/kern/kern_proc.c      Fri Feb 26 18:16:18 2010 +0000
+++ b/sys/kern/kern_proc.c      Fri Feb 26 18:47:13 2010 +0000
@@ -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;



Home | Main Index | Thread Index | Old Index