Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm update maxrss (used to always be 0). Pa...



details:   https://anonhg.NetBSD.org/src/rev/53d4fbdde761
branches:  trunk
changeset: 318864:53d4fbdde761
user:      christos <christos%NetBSD.org@localhost>
date:      Mon May 07 21:00:14 2018 +0000
description:
update maxrss (used to always be 0). Patterned after the OpenBSD changes.

diffstat:

 sys/uvm/uvm_fault.c   |  31 +++++++++++++++++++++++++++++--
 sys/uvm/uvm_fault_i.h |   5 ++++-
 2 files changed, 33 insertions(+), 3 deletions(-)

diffs (78 lines):

diff -r 8abeb2e07353 -r 53d4fbdde761 sys/uvm/uvm_fault.c
--- a/sys/uvm/uvm_fault.c       Mon May 07 19:34:03 2018 +0000
+++ b/sys/uvm/uvm_fault.c       Mon May 07 21:00:14 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_fault.c,v 1.202 2017/11/20 21:06:54 chs Exp $      */
+/*     $NetBSD: uvm_fault.c,v 1.203 2018/05/07 21:00:14 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.202 2017/11/20 21:06:54 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.203 2018/05/07 21:00:14 christos Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -653,6 +653,33 @@
        return error;
 }
 
+/*
+ * Update statistics after fault resolution.
+ * - maxrss
+ */
+void
+uvmfault_update_stats(struct uvm_faultinfo *ufi)
+{
+       struct vm_map           *map;
+       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)
+               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;
+}
 
 /*
  *   F A U L T   -   m a i n   e n t r y   p o i n t
diff -r 8abeb2e07353 -r 53d4fbdde761 sys/uvm/uvm_fault_i.h
--- a/sys/uvm/uvm_fault_i.h     Mon May 07 19:34:03 2018 +0000
+++ b/sys/uvm/uvm_fault_i.h     Mon May 07 21:00:14 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_fault_i.h,v 1.29 2018/04/19 21:50:10 christos Exp $        */
+/*     $NetBSD: uvm_fault_i.h,v 1.30 2018/05/07 21:00:14 christos Exp $        */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -33,6 +33,8 @@
 /*
  * uvm_fault_i.h: fault inline functions
  */
+void uvmfault_update_stats(struct uvm_faultinfo *);
+
 
 /*
  * uvmfault_unlockmaps: unlock the maps
@@ -50,6 +52,7 @@
                return;
        }
 
+       uvmfault_update_stats(ufi);
        if (write_locked) {
                vm_map_unlock(ufi->map);
        } else {



Home | Main Index | Thread Index | Old Index