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.
This commit is contained in:
christos 2018-05-08 19:33:57 +00:00
parent 097a6835fe
commit 87287ec175
3 changed files with 13 additions and 13 deletions

View File

@ -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 @@ struct vmspace {
/* 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) */

View File

@ -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 @@ void
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;
}
/*

View File

@ -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 @@ uvmfault_unlockmaps(struct uvm_faultinfo *ufi, bool write_locked)
return;
}
#ifndef __HAVE_NO_PMAP_STATS
uvmfault_update_stats(ufi);
#endif
if (write_locked) {
vm_map_unlock(ufi->map);
} else {