Module Name:    src
Committed By:   reinoud
Date:           Tue Jan 10 12:07:18 UTC 2012

Modified Files:
        src/sys/arch/usermode/usermode: pmap.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/sys/arch/usermode/usermode/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/usermode/usermode/pmap.c
diff -u src/sys/arch/usermode/usermode/pmap.c:1.100 src/sys/arch/usermode/usermode/pmap.c:1.101
--- src/sys/arch/usermode/usermode/pmap.c:1.100	Tue Jan 10 10:09:49 2012
+++ src/sys/arch/usermode/usermode/pmap.c	Tue Jan 10 12:07:17 2012
@@ -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 <[email protected]>
@@ -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 @@ pmap_bootstrap(void)
 		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 ! */

Reply via email to