Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F110457508
D23326.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D23326.diff
View Options
Index: head/sys/vm/vm_fault.c
===================================================================
--- head/sys/vm/vm_fault.c
+++ head/sys/vm/vm_fault.c
@@ -960,35 +960,8 @@
*/
VM_OBJECT_ASSERT_WLOCKED(fs->object);
next_object = fs->object->backing_object;
- if (next_object == NULL) {
- /*
- * If there's no object left, fill the page in the top
- * object with zeros.
- */
- VM_OBJECT_WUNLOCK(fs->object);
- if (fs->object != fs->first_object) {
- vm_object_pip_wakeup(fs->object);
- fs->object = fs->first_object;
- fs->pindex = fs->first_pindex;
- }
- MPASS(fs->first_m != NULL);
- MPASS(fs->m == NULL);
- fs->m = fs->first_m;
- fs->first_m = NULL;
-
- /*
- * Zero the page if necessary and mark it valid.
- */
- if ((fs->m->flags & PG_ZERO) == 0) {
- pmap_zero_page(fs->m);
- } else {
- VM_CNT_INC(v_ozfod);
- }
- VM_CNT_INC(v_zfod);
- vm_page_valid(fs->m);
-
+ if (next_object == NULL)
return (false);
- }
MPASS(fs->first_m != NULL);
KASSERT(fs->object != next_object, ("object loop %p", next_object));
VM_OBJECT_WLOCK(next_object);
@@ -1002,6 +975,36 @@
return (true);
}
+static void
+vm_fault_zerofill(struct faultstate *fs)
+{
+
+ /*
+ * If there's no object left, fill the page in the top
+ * object with zeros.
+ */
+ if (fs->object != fs->first_object) {
+ vm_object_pip_wakeup(fs->object);
+ fs->object = fs->first_object;
+ fs->pindex = fs->first_pindex;
+ }
+ MPASS(fs->first_m != NULL);
+ MPASS(fs->m == NULL);
+ fs->m = fs->first_m;
+ fs->first_m = NULL;
+
+ /*
+ * Zero the page if necessary and mark it valid.
+ */
+ if ((fs->m->flags & PG_ZERO) == 0) {
+ pmap_zero_page(fs->m);
+ } else {
+ VM_CNT_INC(v_ozfod);
+ }
+ VM_CNT_INC(v_zfod);
+ vm_page_valid(fs->m);
+}
+
/*
* Allocate a page directly or via the object populate method.
*/
@@ -1407,11 +1410,13 @@
* traverse into a backing object or zero fill if none is
* found.
*/
- if (!vm_fault_next(&fs)) {
- /* Don't try to prefault neighboring pages. */
- faultcount = 1;
- break; /* break to PAGE HAS BEEN FOUND. */
- }
+ if (vm_fault_next(&fs))
+ continue;
+ VM_OBJECT_WUNLOCK(fs.object);
+ vm_fault_zerofill(&fs);
+ /* Don't try to prefault neighboring pages. */
+ faultcount = 1;
+ break; /* break to PAGE HAS BEEN FOUND. */
}
/*
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Feb 19, 5:33 PM (21 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16724909
Default Alt Text
D23326.diff (2 KB)
Attached To
Mode
D23326: Move zero fill into its own function so that the object locking is more clear.
Attached
Detach File
Event Timeline
Log In to Comment