Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F147978871
D35470.1784992619.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D35470.1784992619.diff
View Options
Index: sys/vm/vm_map.c
===================================================================
--- sys/vm/vm_map.c
+++ 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);
Index: sys/vm/vm_mmap.c
===================================================================
--- sys/vm/vm_mmap.c
+++ 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) {
Index: sys/vm/vm_pageout.c
===================================================================
--- sys/vm/vm_pageout.c
+++ 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
Sat, Jul 25, 3:16 PM (6 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29257002
Default Alt Text
D35470.1784992619.diff (1 KB)
Attached To
Mode
D35470: vm: Fix racy checks for swap objects
Attached
Detach File
Event Timeline
Log In to Comment