Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F115932844
D35470.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D35470.diff
View Options
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c
--- a/sys/vm/vm_map.c
+++ b/sys/vm/vm_map.c
@@ -2824,9 +2824,6 @@
continue;
}
- if (obj->type != OBJT_DEFAULT &&
- (obj->flags & OBJ_SWAP) == 0)
- continue;
VM_OBJECT_WLOCK(obj);
if (obj->type != OBJT_DEFAULT &&
(obj->flags & OBJ_SWAP) == 0) {
@@ -4139,7 +4136,13 @@
*/
size = src_entry->end - src_entry->start;
if ((src_object = src_entry->object.vm_object) != NULL) {
+ /*
+ * Swap-backed objects need special handling. Note that
+ * this is an unlocked check, so it is possible to race
+ * with an OBJT_DEFAULT -> OBJT_SWAP conversion.
+ */
if (src_object->type == OBJT_DEFAULT ||
+ src_object->type == OBJT_SWAP ||
(src_object->flags & OBJ_SWAP) != 0) {
vm_map_copy_swap_object(src_entry, dst_entry,
size, fork_charge);
diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c
--- a/sys/vm/vm_mmap.c
+++ b/sys/vm/vm_mmap.c
@@ -1368,9 +1368,8 @@
goto done;
}
} else {
- KASSERT(obj->type == OBJT_DEFAULT ||
- (obj->flags & OBJ_SWAP) != 0,
- ("wrong object type"));
+ KASSERT(obj->type == OBJT_DEFAULT || obj->type == OBJT_SWAP ||
+ (obj->flags & OBJ_SWAP) != 0, ("wrong object type"));
vm_object_reference(obj);
#if VM_NRESERVLEVEL > 0
if ((obj->flags & OBJ_COLORED) == 0) {
diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c
--- a/sys/vm/vm_pageout.c
+++ b/sys/vm/vm_pageout.c
@@ -1886,8 +1886,9 @@
if ((entry->eflags & MAP_ENTRY_NEEDS_COPY) != 0 &&
obj->ref_count != 1)
continue;
- if (obj->type == OBJT_DEFAULT || obj->type == OBJT_PHYS ||
- obj->type == OBJT_VNODE || (obj->flags & OBJ_SWAP) != 0)
+ if (obj->type == OBJT_DEFAULT || obj->type == OBJT_SWAP ||
+ obj->type == OBJT_PHYS || obj->type == OBJT_VNODE ||
+ (obj->flags & OBJ_SWAP) != 0)
res += obj->resident_page_count;
}
return (res);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, May 1, 2:12 PM (11 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17883467
Default Alt Text
D35470.diff (1 KB)
Attached To
Mode
D35470: vm: Fix racy checks for swap objects
Attached
Detach File
Event Timeline
Log In to Comment