bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/3] vm: Don't attempt to extend in-transition entries


From: Sergey Bugaev
Subject: [PATCH 2/3] vm: Don't attempt to extend in-transition entries
Date: Fri, 5 Apr 2024 18:18:49 +0300

The in-transition mechanism exists to make it possible to unlock a map
while still making sure some VM entries won't disappear from under you.
This is currently used by the VM copyin mechanics.

Entries in this state are better left alone, and extending/coalescing is
only an optimization, so it makes sense to skip it if the entry to be
extended is in transition. vm_map_coalesce_entry() already checks for
this; check for it in other similar places too.

This is in preparation for using the in-transition mechanism for wiring,
where it's much more important that the entries are not extended while
in transition.
---
 vm/vm_map.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/vm/vm_map.c b/vm/vm_map.c
index 6c06f064..6bfc527f 100644
--- a/vm/vm_map.c
+++ b/vm/vm_map.c
@@ -821,6 +821,7 @@ kern_return_t vm_map_find_entry(
            (entry->vme_end == start) &&
            (!entry->is_shared) &&
            (!entry->is_sub_map) &&
+           (!entry->in_transition) &&
            (entry->object.vm_object == object) &&
            (entry->needs_copy == FALSE) &&
            (entry->inheritance == VM_INHERIT_DEFAULT) &&
@@ -1055,6 +1056,7 @@ kern_return_t vm_map_enter(
            (entry->vme_end == start) &&
            (!entry->is_shared) &&
            (!entry->is_sub_map) &&
+           (!entry->in_transition) &&
            (entry->inheritance == inheritance) &&
            (entry->protection == cur_protection) &&
            (entry->max_protection == max_protection) &&
@@ -1090,6 +1092,7 @@ kern_return_t vm_map_enter(
            (next_entry->vme_start == end) &&
            (!next_entry->is_shared) &&
            (!next_entry->is_sub_map) &&
+           (!next_entry->in_transition) &&
            (next_entry->inheritance == inheritance) &&
            (next_entry->protection == cur_protection) &&
            (next_entry->max_protection == max_protection) &&
@@ -3054,6 +3057,7 @@ kern_return_t vm_map_copyout_page_list(
            last->inheritance != VM_INHERIT_DEFAULT ||
            last->protection != VM_PROT_DEFAULT ||
            last->max_protection != VM_PROT_ALL ||
+           last->in_transition ||
            (must_wire ? (last->wired_count == 0)
                       : (last->wired_count != 0))) {
                    goto create_object;
-- 
2.44.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]