Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/hppa port-hppa/56849: Wacko kernel memory accountin...



details:   https://anonhg.NetBSD.org/src/rev/211ffd0528ac
branches:  trunk
changeset: 366409:211ffd0528ac
user:      skrll <skrll%NetBSD.org@localhost>
date:      Thu May 26 05:34:04 2022 +0000

description:
port-hppa/56849: Wacko kernel memory accounting in current/hppa

Two fixes:
- Don't include direct mapped memory in pmap statistics
- Decrement pmap statistics counts in pmap_kremove

diffstat:

 sys/arch/hppa/hppa/pmap.c    |  16 +++++++++++-----
 sys/arch/hppa/include/pmap.h |   4 +++-
 2 files changed, 14 insertions(+), 6 deletions(-)

diffs (69 lines):

diff -r eeb805d8b7d7 -r 211ffd0528ac sys/arch/hppa/hppa/pmap.c
--- a/sys/arch/hppa/hppa/pmap.c Thu May 26 02:24:00 2022 +0000
+++ b/sys/arch/hppa/hppa/pmap.c Thu May 26 05:34:04 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.116 2022/04/09 23:38:32 riastradh Exp $     */
+/*     $NetBSD: pmap.c,v 1.117 2022/05/26 05:34:04 skrll Exp $ */
 
 /*-
  * Copyright (c) 2001, 2002, 2020 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.116 2022/04/09 23:38:32 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.117 2022/05/26 05:34:04 skrll Exp $");
 
 #include "opt_cputype.h"
 
@@ -1109,7 +1109,7 @@
                else if (va == uvm_lwp_getuarea(&lwp0) + USPACE - PAGE_SIZE)
                        prot = UVM_PROT_NONE;
 #endif
-               pmap_kenter_pa(va, va, prot, 0);
+               pmap_kenter_pa(va, va, prot, PMAP_DIRECTMAP);
        }
 
        /* XXXNH update */
@@ -1990,8 +1990,11 @@
            pmap_prot(pmap_kernel(), prot & VM_PROT_ALL));
        if (IS_IOPAGE_P(pa) || (flags & PMAP_NOCACHE))
                pte |= PTE_PROT(TLB_UNCACHEABLE);
-       pmap_kernel()->pm_stats.wired_count++;
-       pmap_kernel()->pm_stats.resident_count++;
+
+       if ((flags & PMAP_DIRECTMAP) == 0) {
+               pmap_kernel()->pm_stats.wired_count++;
+               pmap_kernel()->pm_stats.resident_count++;
+       }
        if (opte)
                pmap_pte_flush(pmap_kernel(), va, opte);
 
@@ -2071,6 +2074,9 @@
                pmap_pte_flush(pmap, va, pte);
                pmap_pte_set(pde, va, 0);
 
+               pmap->pm_stats.wired_count--;
+               pmap->pm_stats.resident_count--;
+
                pg = pmap_initialized ? PHYS_TO_VM_PAGE(PTE_PAGE(pte)) : NULL;
                if (pg != NULL) {
                        struct vm_page_md * const md = VM_PAGE_TO_MD(pg);
diff -r eeb805d8b7d7 -r 211ffd0528ac sys/arch/hppa/include/pmap.h
--- a/sys/arch/hppa/include/pmap.h      Thu May 26 02:24:00 2022 +0000
+++ b/sys/arch/hppa/include/pmap.h      Thu May 26 05:34:04 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.h,v 1.40 2020/03/14 14:05:42 ad Exp $     */
+/*     $NetBSD: pmap.h,v 1.41 2022/05/26 05:34:04 skrll Exp $  */
 
 /*     $OpenBSD: pmap.h,v 1.35 2007/12/14 18:32:23 deraadt Exp $       */
 
@@ -72,6 +72,8 @@
 #define        HPPA_MAX_PID    0xfffa
 #define        HPPA_SID_MAX    0x7ffd
 
+#define        PMAP_DIRECTMAP  0x10000000 /* kenter_pa */
+
 /*
  * DON'T CHANGE THIS - this is assumed in lots of places.
  */



Home | Main Index | Thread Index | Old Index