From 4565fa16977a4fac5f98cb75e9f5559d67c6446f Mon Sep 17 00:00:00 2001 From: alc Date: Sat, 29 Dec 2007 19:53:04 +0000 Subject: 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.) --- sys/vm/vm_fault.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'sys/vm/vm_fault.c') 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 __FBSDID("$FreeBSD$"); +#include "opt_vm.h" + #include #include #include @@ -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; -- cgit v1.1