Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm don't store the rssmax in the lwp rusag...



details:   https://anonhg.NetBSD.org/src/rev/b8a7f36f5e0c
branches:  trunk
changeset: 318882:b8a7f36f5e0c
user:      christos <christos%NetBSD.org@localhost>
date:      Tue May 08 19:33:57 2018 +0000
description:
don't store the rssmax in the lwp rusage, it is a per proc property. Instead
utilize an unused field in the vmspace struct to store it. Also conditionalize
on platforms that have pmap statistics available.

diffstat:

 sys/uvm/uvm_extern.h  |   4 ++--
 sys/uvm/uvm_fault.c   |  18 ++++++++----------
 sys/uvm/uvm_fault_i.h |   4 +++-
 3 files changed, 13 insertions(+), 13 deletions(-)

diffs (86 lines):

diff -r d5d71f3f5dd0 -r b8a7f36f5e0c sys/uvm/uvm_extern.h
--- a/sys/uvm/uvm_extern.h      Tue May 08 17:20:44 2018 +0000
+++ b/sys/uvm/uvm_extern.h      Tue May 08 19:33:57 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_extern.h,v 1.210 2018/04/20 19:02:18 jdolecek Exp $        */
+/*     $NetBSD: uvm_extern.h,v 1.211 2018/05/08 19:33:57 christos Exp $        */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -557,7 +557,7 @@
 /* we copy from vm_startcopy to the end of the structure on fork */
 #define vm_startcopy vm_rssize
        segsz_t vm_rssize;      /* current resident set size in pages */
-       segsz_t vm_swrss;       /* resident set size before last swap */
+       segsz_t vm_rssmax;      /* max resident size in pages */
        segsz_t vm_tsize;       /* text size (pages) XXX */
        segsz_t vm_dsize;       /* data size (pages) XXX */
        segsz_t vm_ssize;       /* stack size (pages) */
diff -r d5d71f3f5dd0 -r b8a7f36f5e0c sys/uvm/uvm_fault.c
--- a/sys/uvm/uvm_fault.c       Tue May 08 17:20:44 2018 +0000
+++ b/sys/uvm/uvm_fault.c       Tue May 08 19:33:57 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_fault.c,v 1.203 2018/05/07 21:00:14 christos Exp $ */
+/*     $NetBSD: uvm_fault.c,v 1.204 2018/05/08 19:33:57 christos Exp $ */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.203 2018/05/07 21:00:14 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.204 2018/05/08 19:33:57 christos Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -661,24 +661,22 @@
 uvmfault_update_stats(struct uvm_faultinfo *ufi)
 {
        struct vm_map           *map;
+       struct vmspace          *vm;
        struct proc             *p;
-       struct lwp              *l;
        vsize_t                  res;
 
        map = ufi->orig_map;
 
        p = curproc;
        KASSERT(p != NULL);
-       if (&p->p_vmspace->vm_map != map)
+       vm = p->p_vmspace;
+
+       if (&vm->vm_map != map)
                return;
 
        res = pmap_resident_count(map->pmap);
-       /* Convert res from pages to kilobytes. */
-       res <<= (PAGE_SHIFT - 10);
-
-       l = curlwp;
-       if (l->l_ru.ru_maxrss < res)
-               l->l_ru.ru_maxrss = res;
+       if (vm->vm_rssmax < res)
+               vm->vm_rssmax = res;
 }
 
 /*
diff -r d5d71f3f5dd0 -r b8a7f36f5e0c sys/uvm/uvm_fault_i.h
--- a/sys/uvm/uvm_fault_i.h     Tue May 08 17:20:44 2018 +0000
+++ b/sys/uvm/uvm_fault_i.h     Tue May 08 19:33:57 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_fault_i.h,v 1.30 2018/05/07 21:00:14 christos Exp $        */
+/*     $NetBSD: uvm_fault_i.h,v 1.31 2018/05/08 19:33:57 christos Exp $        */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -52,7 +52,9 @@
                return;
        }
 
+#ifndef __HAVE_NO_PMAP_STATS
        uvmfault_update_stats(ufi);
+#endif
        if (write_locked) {
                vm_map_unlock(ufi->map);
        } else {



Home | Main Index | Thread Index | Old Index