Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/usermode/usermode Use thunk_madvise() on the memory...



details:   https://anonhg.NetBSD.org/src/rev/db6262e306b1
branches:  trunk
changeset: 772642:db6262e306b1
user:      reinoud <reinoud%NetBSD.org@localhost>
date:      Tue Jan 10 12:07:17 2012 +0000

description:
Use thunk_madvise() on the memory space hinting the kernel we are using it in
a random order and hint the kernel that we we need the memory.i

No measured effect on a memory file on tmpfs /tmp though.

diffstat:

 sys/arch/usermode/usermode/pmap.c |  11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diffs (32 lines):

diff -r 91ce3d54ef4b -r db6262e306b1 sys/arch/usermode/usermode/pmap.c
--- a/sys/arch/usermode/usermode/pmap.c Tue Jan 10 12:04:56 2012 +0000
+++ b/sys/arch/usermode/usermode/pmap.c Tue Jan 10 12:07:17 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.100 2012/01/10 10:09:49 reinoud Exp $ */
+/* $NetBSD: pmap.c,v 1.101 2012/01/10 12:07:17 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Reinoud Zandijk <reinoud%NetBSD.org@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.100 2012/01/10 10:09:49 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.101 2012/01/10 12:07:17 reinoud Exp $");
 
 #include "opt_memsize.h"
 #include "opt_kmempages.h"
@@ -255,6 +255,13 @@
                THUNK_PROT_READ | THUNK_PROT_EXEC);
        assert(err == 0);
 
+       /* madvise the host kernel about our intentions with the memory */
+       /* no measured effect, but might make a difference on high load */
+       err = thunk_madvise((void *) kmem_user_start,
+               kmem_k_start - kmem_user_start,
+               THUNK_MADV_WILLNEED | THUNK_MADV_RANDOM);
+       assert(err == 0);
+
        /* initialize counters */
        fpos = 0;
        free_start = fpos;     /* in physical space ! */



Home | Main Index | Thread Index | Old Index