Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F166263946
D22820.id65907.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D22820.id65907.diff
View Options
Index: head/sys/vm/vm_fault.c
===================================================================
--- head/sys/vm/vm_fault.c
+++ head/sys/vm/vm_fault.c
@@ -684,6 +684,41 @@
return (KERN_RESOURCE_SHORTAGE);
}
+/*
+ * Wait/Retry if the page is busy. We have to do this if the page is
+ * either exclusive or shared busy because the vm_pager may be using
+ * read busy for pageouts (and even pageins if it is the vnode pager),
+ * and we could end up trying to pagein and pageout the same page
+ * simultaneously.
+ *
+ * We can theoretically allow the busy case on a read fault if the page
+ * is marked valid, but since such pages are typically already pmap'd,
+ * putting that special case in might be more effort then it is worth.
+ * We cannot under any circumstances mess around with a shared busied
+ * page except, perhaps, to pmap it.
+ */
+static void
+vm_fault_busy_sleep(struct faultstate *fs)
+{
+ /*
+ * Reference the page before unlocking and
+ * sleeping so that the page daemon is less
+ * likely to reclaim it.
+ */
+ vm_page_aflag_set(fs->m, PGA_REFERENCED);
+ if (fs->object != fs->first_object) {
+ fault_page_release(&fs->first_m);
+ vm_object_pip_wakeup(fs->first_object);
+ }
+ vm_object_pip_wakeup(fs->object);
+ unlock_map(fs);
+ if (fs->m == vm_page_lookup(fs->object, fs->pindex))
+ vm_page_sleep_if_busy(fs->m, "vmpfw");
+ VM_OBJECT_WUNLOCK(fs->object);
+ VM_CNT_INC(v_intrans);
+ vm_object_deallocate(fs->first_object);
+}
+
int
vm_fault(vm_map_t map, vm_offset_t vaddr, vm_prot_t fault_type,
int fault_flags, vm_page_t *m_hold)
@@ -822,42 +857,8 @@
*/
fs.m = vm_page_lookup(fs.object, fs.pindex);
if (fs.m != NULL) {
- /*
- * Wait/Retry if the page is busy. We have to do this
- * if the page is either exclusive or shared busy
- * because the vm_pager may be using read busy for
- * pageouts (and even pageins if it is the vnode
- * pager), and we could end up trying to pagein and
- * pageout the same page simultaneously.
- *
- * We can theoretically allow the busy case on a read
- * fault if the page is marked valid, but since such
- * pages are typically already pmap'd, putting that
- * special case in might be more effort then it is
- * worth. We cannot under any circumstances mess
- * around with a shared busied page except, perhaps,
- * to pmap it.
- */
if (vm_page_tryxbusy(fs.m) == 0) {
- /*
- * Reference the page before unlocking and
- * sleeping so that the page daemon is less
- * likely to reclaim it.
- */
- vm_page_aflag_set(fs.m, PGA_REFERENCED);
- if (fs.object != fs.first_object) {
- fault_page_release(&fs.first_m);
- vm_object_pip_wakeup(fs.first_object);
- }
- unlock_map(&fs);
- vm_object_pip_wakeup(fs.object);
- if (fs.m == vm_page_lookup(fs.object,
- fs.pindex)) {
- vm_page_sleep_if_busy(fs.m, "vmpfw");
- }
- VM_OBJECT_WUNLOCK(fs.object);
- VM_CNT_INC(v_intrans);
- vm_object_deallocate(fs.first_object);
+ vm_fault_busy_sleep(&fs);
goto RetryFault;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Aug 13, 2:59 PM (6 m, 19 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
36571923
Default Alt Text
D22820.id65907.diff (3 KB)
Attached To
Mode
D22820: Move the fault busy sleep into its own function.
Attached
Detach File
Event Timeline
Log In to Comment