Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm uvm_availmem(): give it a boolean argument to specif...



details:   https://anonhg.NetBSD.org/src/rev/ea5a88a0218f
branches:  trunk
changeset: 934417:ea5a88a0218f
user:      ad <ad%NetBSD.org@localhost>
date:      Thu Jun 11 19:20:42 2020 +0000

description:
uvm_availmem(): give it a boolean argument to specify whether a recent
cached value will do, or if the very latest total must be fetched.  It can
be called thousands of times a second and fetching the totals impacts not
only the calling LWP but other CPUs doing unrelated activity in the VM
system.

diffstat:

 external/cddl/osnet/dist/uts/common/fs/zfs/arc.c |   2 +-
 external/cddl/osnet/sys/kern/misc.c              |   4 ++--
 sys/arch/alpha/alpha/machdep.c                   |   6 +++---
 sys/arch/atari/atari/machdep.c                   |   6 +++---
 sys/arch/cesfic/cesfic/machdep.c                 |   6 +++---
 sys/arch/emips/emips/machdep.c                   |   6 +++---
 sys/arch/evbppc/explora/machdep.c                |   6 +++---
 sys/arch/evbppc/virtex/machdep.c                 |   6 +++---
 sys/arch/evbppc/walnut/machdep.c                 |   6 +++---
 sys/arch/ews4800mips/ews4800mips/machdep.c       |   6 +++---
 sys/arch/hp300/hp300/machdep.c                   |   6 +++---
 sys/arch/hppa/hppa/machdep.c                     |   6 +++---
 sys/arch/luna68k/luna68k/machdep.c               |   6 +++---
 sys/arch/mac68k/mac68k/machdep.c                 |   6 +++---
 sys/arch/mips/mips/cpu_subr.c                    |   6 +++---
 sys/arch/mvme68k/mvme68k/machdep.c               |   6 +++---
 sys/arch/news68k/news68k/machdep.c               |   6 +++---
 sys/arch/next68k/next68k/machdep.c               |   6 +++---
 sys/arch/powerpc/booke/booke_machdep.c           |   6 +++---
 sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c         |   6 +++---
 sys/arch/powerpc/oea/oea_machdep.c               |   6 +++---
 sys/arch/riscv/riscv/riscv_machdep.c             |   4 ++--
 sys/arch/sgimips/sgimips/machdep.c               |   6 +++---
 sys/arch/sh3/sh3/sh3_machdep.c                   |   6 +++---
 sys/arch/sparc/sparc/machdep.c                   |   6 +++---
 sys/arch/sparc64/sparc64/machdep.c               |   6 +++---
 sys/arch/sun2/sun2/machdep.c                     |   6 +++---
 sys/arch/sun3/sun3/machdep.c                     |   6 +++---
 sys/arch/sun3/sun3x/machdep.c                    |   6 +++---
 sys/arch/vax/vax/machdep.c                       |   6 +++---
 sys/arch/x68k/x68k/machdep.c                     |   6 +++---
 sys/compat/linux/common/linux_misc.c             |   6 +++---
 sys/compat/linux32/common/linux32_sysinfo.c      |   6 +++---
 sys/dev/ccd.c                                    |   6 +++---
 sys/fs/tmpfs/tmpfs_mem.c                         |   9 ++++-----
 sys/kern/init_main.c                             |   6 +++---
 sys/kern/kern_module.c                           |   6 +++---
 sys/kern/kern_proc.c                             |   6 +++---
 sys/kern/vfs_bio.c                               |   6 +++---
 sys/miscfs/procfs/procfs_linux.c                 |   6 +++---
 sys/rump/librump/rumpkern/vm.c                   |   6 +++---
 sys/ufs/chfs/chfs_subr.c                         |   4 ++--
 sys/ufs/lfs/lfs_bio.c                            |   8 ++++----
 sys/uvm/uvm_extern.h                             |   4 ++--
 sys/uvm/uvm_glue.c                               |   6 +++---
 sys/uvm/uvm_meter.c                              |  10 +++++-----
 sys/uvm/uvm_page.c                               |   6 +++---
 sys/uvm/uvm_pdaemon.c                            |  23 ++++++++++++-----------
 sys/uvm/uvm_pdpolicy_clock.c                     |   6 +++---
 sys/uvm/uvm_pglist.c                             |   8 ++++----
 sys/uvm/uvm_stat.c                               |   6 +++---
 51 files changed, 161 insertions(+), 161 deletions(-)

diffs (truncated from 1444 to 300 lines):

diff -r 446f77e2dede -r ea5a88a0218f external/cddl/osnet/dist/uts/common/fs/zfs/arc.c
--- a/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c  Thu Jun 11 18:42:02 2020 +0000
+++ b/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c  Thu Jun 11 19:20:42 2020 +0000
@@ -285,7 +285,7 @@
 #endif
 //#define      needfree        (uvm_availmem() < uvmexp.freetarg ? uvmexp.freetarg : 0)
 #define        buf_init        arc_buf_init
-#define        freemem         uvm_availmem()
+#define        freemem         uvm_availmem(false)
 #define        minfree         uvmexp.freemin
 #define        desfree         uvmexp.freetarg
 #define        lotsfree        (desfree * 2)
diff -r 446f77e2dede -r ea5a88a0218f external/cddl/osnet/sys/kern/misc.c
--- a/external/cddl/osnet/sys/kern/misc.c       Thu Jun 11 18:42:02 2020 +0000
+++ b/external/cddl/osnet/sys/kern/misc.c       Thu Jun 11 19:20:42 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: misc.c,v 1.8 2020/02/19 16:11:19 riastradh Exp $       */
+/*     $NetBSD: misc.c,v 1.9 2020/06/11 19:20:42 ad Exp $      */
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@
        int bufcnt;
        struct pool *pp;
        
-       bufcnt = uvmexp.freetarg - uvm_availmem();
+       bufcnt = uvmexp.freetarg - uvm_availmem(false);
        if (bufcnt < 0)
                bufcnt = 0;
 
diff -r 446f77e2dede -r ea5a88a0218f sys/arch/alpha/alpha/machdep.c
--- a/sys/arch/alpha/alpha/machdep.c    Thu Jun 11 18:42:02 2020 +0000
+++ b/sys/arch/alpha/alpha/machdep.c    Thu Jun 11 19:20:42 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.359 2020/02/22 20:29:15 thorpej Exp $ */
+/* $NetBSD: machdep.c,v 1.360 2020/06/11 19:20:42 ad Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2019 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.359 2020/02/22 20:29:15 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.360 2020/06/11 19:20:42 ad Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -869,7 +869,7 @@
 #if defined(DEBUG)
        pmapdebug = opmapdebug;
 #endif
-       format_bytes(pbuf, sizeof(pbuf), ptoa(uvm_availmem()));
+       format_bytes(pbuf, sizeof(pbuf), ptoa(uvm_availmem(false)));
        printf("avail memory = %s\n", pbuf);
 #if 0
        {
diff -r 446f77e2dede -r ea5a88a0218f sys/arch/atari/atari/machdep.c
--- a/sys/arch/atari/atari/machdep.c    Thu Jun 11 18:42:02 2020 +0000
+++ b/sys/arch/atari/atari/machdep.c    Thu Jun 11 19:20:42 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.182 2019/12/31 13:07:09 ad Exp $ */
+/*     $NetBSD: machdep.c,v 1.183 2020/06/11 19:20:43 ad Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.182 2019/12/31 13:07:09 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.183 2020/06/11 19:20:43 ad Exp $");
 
 #include "opt_ddb.h"
 #include "opt_compat_netbsd.h"
@@ -211,7 +211,7 @@
 #ifdef DEBUG
        pmapdebug = opmapdebug;
 #endif
-       format_bytes(pbuf, sizeof(pbuf), ptoa(uvm_availmem()));
+       format_bytes(pbuf, sizeof(pbuf), ptoa(uvm_availmem(false)));
        printf("avail memory = %s\n", pbuf);
 
        /*
diff -r 446f77e2dede -r ea5a88a0218f sys/arch/cesfic/cesfic/machdep.c
--- a/sys/arch/cesfic/cesfic/machdep.c  Thu Jun 11 18:42:02 2020 +0000
+++ b/sys/arch/cesfic/cesfic/machdep.c  Thu Jun 11 19:20:42 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.70 2019/12/31 13:07:10 ad Exp $  */
+/*     $NetBSD: machdep.c,v 1.71 2020/06/11 19:20:43 ad Exp $  */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.70 2019/12/31 13:07:10 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.71 2020/06/11 19:20:43 ad Exp $");
 
 #include "opt_bufcache.h"
 #include "opt_ddb.h"
@@ -260,7 +260,7 @@
 #ifdef DEBUG
        pmapdebug = opmapdebug;
 #endif
-       printf("avail mem = %ld\n", ptoa(uvm_availmem()));
+       printf("avail mem = %ld\n", ptoa(uvm_availmem(false)));
 }
 
 /*
diff -r 446f77e2dede -r ea5a88a0218f sys/arch/emips/emips/machdep.c
--- a/sys/arch/emips/emips/machdep.c    Thu Jun 11 18:42:02 2020 +0000
+++ b/sys/arch/emips/emips/machdep.c    Thu Jun 11 19:20:42 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.16 2020/01/12 13:15:10 tsutsui Exp $     */
+/*     $NetBSD: machdep.c,v 1.17 2020/06/11 19:20:43 ad Exp $  */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.16 2020/01/12 13:15:10 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.17 2020/06/11 19:20:43 ad Exp $");
 
 #include "opt_ddb.h"
 
@@ -460,7 +460,7 @@
 #ifdef DEBUG
        pmapdebug = opmapdebug;
 #endif
-       format_bytes(pbuf, sizeof(pbuf), ptoa(uvm_availmem()));
+       format_bytes(pbuf, sizeof(pbuf), ptoa(uvm_availmem(false)));
        printf("avail memory = %s\n", pbuf);
 }
 
diff -r 446f77e2dede -r ea5a88a0218f sys/arch/evbppc/explora/machdep.c
--- a/sys/arch/evbppc/explora/machdep.c Thu Jun 11 18:42:02 2020 +0000
+++ b/sys/arch/evbppc/explora/machdep.c Thu Jun 11 19:20:42 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.39 2019/12/31 13:07:10 ad Exp $  */
+/*     $NetBSD: machdep.c,v 1.40 2020/06/11 19:20:43 ad Exp $  */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.39 2019/12/31 13:07:10 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.40 2020/06/11 19:20:43 ad Exp $");
 
 #include "opt_explora.h"
 #include "opt_modular.h"
@@ -179,7 +179,7 @@
         * pool pages.
         */
 
-       format_bytes(pbuf, sizeof(pbuf), ptoa(uvm_availmem()));
+       format_bytes(pbuf, sizeof(pbuf), ptoa(uvm_availmem(false)));
        printf("avail memory = %s\n", pbuf);
 
        /*
diff -r 446f77e2dede -r ea5a88a0218f sys/arch/evbppc/virtex/machdep.c
--- a/sys/arch/evbppc/virtex/machdep.c  Thu Jun 11 18:42:02 2020 +0000
+++ b/sys/arch/evbppc/virtex/machdep.c  Thu Jun 11 19:20:42 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.24 2019/12/31 13:07:10 ad Exp $ */
+/*     $NetBSD: machdep.c,v 1.25 2020/06/11 19:20:43 ad Exp $ */
 
 /*
  * Copyright (c) 2006 Jachym Holecek
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.24 2019/12/31 13:07:10 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.25 2020/06/11 19:20:43 ad Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_ddb.h"
@@ -202,7 +202,7 @@
         * pool pages.
         */
 
-       format_bytes(pbuf, sizeof(pbuf), ptoa(uvm_availmem()));
+       format_bytes(pbuf, sizeof(pbuf), ptoa(uvm_availmem(false)));
        printf("avail memory = %s\n", pbuf);
 
        /*
diff -r 446f77e2dede -r ea5a88a0218f sys/arch/evbppc/walnut/machdep.c
--- a/sys/arch/evbppc/walnut/machdep.c  Thu Jun 11 18:42:02 2020 +0000
+++ b/sys/arch/evbppc/walnut/machdep.c  Thu Jun 11 19:20:42 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.58 2019/12/31 13:07:10 ad Exp $  */
+/*     $NetBSD: machdep.c,v 1.59 2020/06/11 19:20:43 ad Exp $  */
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.58 2019/12/31 13:07:10 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.59 2020/06/11 19:20:43 ad Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_ddb.h"
@@ -259,7 +259,7 @@
         * pool pages.
         */
 
-       format_bytes(pbuf, sizeof(pbuf), ptoa(uvm_availmem()));
+       format_bytes(pbuf, sizeof(pbuf), ptoa(uvm_availmem(false)));
        printf("avail memory = %s\n", pbuf);
 
        /*
diff -r 446f77e2dede -r ea5a88a0218f sys/arch/ews4800mips/ews4800mips/machdep.c
--- a/sys/arch/ews4800mips/ews4800mips/machdep.c        Thu Jun 11 18:42:02 2020 +0000
+++ b/sys/arch/ews4800mips/ews4800mips/machdep.c        Thu Jun 11 19:20:42 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.30 2019/12/31 13:07:10 ad Exp $  */
+/*     $NetBSD: machdep.c,v 1.31 2020/06/11 19:20:43 ad Exp $  */
 
 /*-
  * Copyright (c) 2001, 2004, 2005 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.30 2019/12/31 13:07:10 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.31 2020/06/11 19:20:43 ad Exp $");
 
 #include "opt_ddb.h"
 
@@ -230,7 +230,7 @@
         * are allocated via the pool allocator, and we use KSEG to
         * map those pages.)
         */
-       format_bytes(pbuf, sizeof(pbuf), ptoa(uvm_availmem()));
+       format_bytes(pbuf, sizeof(pbuf), ptoa(uvm_availmem(false)));
        printf("avail memory = %s\n", pbuf);
 }
 
diff -r 446f77e2dede -r ea5a88a0218f sys/arch/hp300/hp300/machdep.c
--- a/sys/arch/hp300/hp300/machdep.c    Thu Jun 11 18:42:02 2020 +0000
+++ b/sys/arch/hp300/hp300/machdep.c    Thu Jun 11 19:20:42 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.233 2020/04/21 09:02:33 tsutsui Exp $    */
+/*     $NetBSD: machdep.c,v 1.234 2020/06/11 19:20:43 ad Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.233 2020/04/21 09:02:33 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.234 2020/06/11 19:20:43 ad Exp $");
 
 #include "opt_ddb.h"
 #include "opt_compat_netbsd.h"
@@ -324,7 +324,7 @@
 #ifdef DEBUG
        pmapdebug = opmapdebug;
 #endif
-       format_bytes(pbuf, sizeof(pbuf), ptoa(uvm_availmem()));
+       format_bytes(pbuf, sizeof(pbuf), ptoa(uvm_availmem(false)));
        printf("avail memory = %s\n", pbuf);
 
        /*
diff -r 446f77e2dede -r ea5a88a0218f sys/arch/hppa/hppa/machdep.c
--- a/sys/arch/hppa/hppa/machdep.c      Thu Jun 11 18:42:02 2020 +0000
+++ b/sys/arch/hppa/hppa/machdep.c      Thu Jun 11 19:20:42 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.13 2020/04/15 15:50:15 skrll Exp $       */
+/*     $NetBSD: machdep.c,v 1.14 2020/06/11 19:20:43 ad Exp $  */
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.13 2020/04/15 15:50:15 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.14 2020/06/11 19:20:43 ad Exp $");
 
 #include "opt_cputype.h"
 #include "opt_ddb.h"
@@ -931,7 +931,7 @@
        phys_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
            VM_PHYS_SIZE, 0, false, NULL);
 
-       format_bytes(pbuf[0], sizeof(pbuf[0]), ptoa(uvm_availmem()));
+       format_bytes(pbuf[0], sizeof(pbuf[0]), ptoa(uvm_availmem(false)));
        printf("avail mem = %s\n", pbuf[0]);
 }
 



Home | Main Index | Thread Index | Old Index