svn commit: r234007 - user/attilio/vmcontention/sys/vm
Attilio Rao
attilio at FreeBSD.org
Sat Apr 7 23:58:49 UTC 2012
Author: attilio
Date: Sat Apr 7 23:58:49 2012
New Revision: 234007
URL: http://svn.freebsd.org/changeset/base/234007
Log:
If we already had a page with pindex == 0 in the device pager object
(if not already fictious) the code can panic when trying to first insert
a fictious page because of the overridden pindex.
Fix this by applying the same spinning pattern of vm_page_rename().
Reported by: pho
Modified:
user/attilio/vmcontention/sys/vm/device_pager.c
Modified: user/attilio/vmcontention/sys/vm/device_pager.c
==============================================================================
--- user/attilio/vmcontention/sys/vm/device_pager.c Sat Apr 7 23:51:16 2012 (r234006)
+++ user/attilio/vmcontention/sys/vm/device_pager.c Sat Apr 7 23:58:49 2012 (r234007)
@@ -52,6 +52,8 @@ __FBSDID("$FreeBSD$");
#include <vm/vm_pager.h>
#include <vm/uma.h>
+#include <machine/cpu.h>
+
static void dev_pager_init(void);
static vm_object_t dev_pager_alloc(void *, vm_ooffset_t, vm_prot_t,
vm_ooffset_t, struct ucred *);
@@ -259,7 +261,7 @@ old_dev_pager_fault(vm_object_t object,
struct file *fpop;
struct thread *td;
vm_memattr_t memattr;
- int ref, ret;
+ int i, ref, ret;
pidx = OFF_TO_IDX(offset);
memattr = object->memattr;
@@ -307,14 +309,14 @@ old_dev_pager_fault(vm_object_t object,
*/
page = vm_page_getfake(paddr, memattr);
VM_OBJECT_LOCK(object);
- if (vm_page_insert(page, object, offset) != 0) {
- vm_page_putfake(page);
- return (VM_PAGER_FAIL);
- }
vm_page_lock(*mres);
vm_page_free(*mres);
vm_page_unlock(*mres);
*mres = page;
+ while (vm_page_insert(page, object, offset) != 0) {
+ for (i = 0; i < 10000000; i++)
+ cpu_spinwait();
+ }
}
page->valid = VM_PAGE_BITS_ALL;
return (VM_PAGER_OK);
More information about the svn-src-user
mailing list