summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_fault.c
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2007-12-29 19:53:04 +0000
committeralc <alc@FreeBSD.org>2007-12-29 19:53:04 +0000
commit4565fa16977a4fac5f98cb75e9f5559d67c6446f (patch)
tree53711ee4be0bb0ef15bc2d3bbc2d1e3908061be8 /sys/vm/vm_fault.c
parentcfcf7dfc62d30c66adf52384e97d4157bab82146 (diff)
downloadFreeBSD-src-4565fa16977a4fac5f98cb75e9f5559d67c6446f.zip
FreeBSD-src-4565fa16977a4fac5f98cb75e9f5559d67c6446f.tar.gz
Add the superpage reservation system. This is "part 2 of 2" of the
machine-independent support for superpages. (The earlier part was the rewrite of the physical memory allocator.) The remainder of the code required for superpages support is machine-dependent and will be added to the various pmap implementations at a later date. Initially, I am only supporting one large page size per architecture. Moreover, I am only enabling the reservation system on amd64. (In an emergency, it can be disabled by setting VM_NRESERVLEVELS to 0 in amd64/include/vmparam.h or your kernel configuration file.)
Diffstat (limited to 'sys/vm/vm_fault.c')
-rw-r--r--sys/vm/vm_fault.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c
index 49a4077..d2a8220 100644
--- a/sys/vm/vm_fault.c
+++ b/sys/vm/vm_fault.c
@@ -74,6 +74,8 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include "opt_vm.h"
+
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
@@ -429,6 +431,13 @@ RetryFault:;
*/
fs.m = NULL;
if (!vm_page_count_severe()) {
+#if VM_NRESERVLEVEL > 0
+ if ((fs.object->flags & OBJ_COLORED) == 0) {
+ fs.object->flags |= OBJ_COLORED;
+ fs.object->pg_color = atop(vaddr) -
+ fs.pindex;
+ }
+#endif
fs.m = vm_page_alloc(fs.object, fs.pindex,
(fs.vp || fs.object->backing_object)? VM_ALLOC_NORMAL: VM_ALLOC_ZERO);
}
@@ -1107,6 +1116,10 @@ vm_fault_copy_entry(dst_map, src_map, dst_entry, src_entry)
*/
dst_object = vm_object_allocate(OBJT_DEFAULT,
OFF_TO_IDX(dst_entry->end - dst_entry->start));
+#if VM_NRESERVLEVEL > 0
+ dst_object->flags |= OBJ_COLORED;
+ dst_object->pg_color = atop(dst_entry->start);
+#endif
VM_OBJECT_LOCK(dst_object);
dst_entry->object.vm_object = dst_object;
OpenPOWER on IntegriCloud