svn commit: r357052 - head/sys/vm
Mark Johnston
markj at FreeBSD.org
Thu Jan 23 16:45:11 UTC 2020
Author: markj
Date: Thu Jan 23 16:45:10 2020
New Revision: 357052
URL: https://svnweb.freebsd.org/changeset/base/357052
Log:
vm_map_submap(): Avoid unnecessary clipping.
A submap can only be created from an entry spanning the entire request
range. In particular, if vm_map_lookup_entry() returns false or the
returned entry contains "end".
Since the only use of submaps in FreeBSD is for the static pipe and
execve argument KVA maps, this has no functional effect.
Github PR: https://github.com/freebsd/freebsd/pull/420
Submitted by: Wuyang Chung <wuyang.chung1 at gmail.com> (original)
Reviewed by: dougm, kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D23299
Modified:
head/sys/vm/vm_map.c
Modified: head/sys/vm/vm_map.c
==============================================================================
--- head/sys/vm/vm_map.c Thu Jan 23 16:36:58 2020 (r357051)
+++ head/sys/vm/vm_map.c Thu Jan 23 16:45:10 2020 (r357052)
@@ -2477,19 +2477,12 @@ vm_map_submap(
vm_map_unlock(submap);
vm_map_lock(map);
-
VM_MAP_RANGE_CHECK(map, start, end);
-
- if (vm_map_lookup_entry(map, start, &entry)) {
+ if (vm_map_lookup_entry(map, start, &entry) && entry->end >= end &&
+ (entry->eflags & MAP_ENTRY_COW) == 0 &&
+ entry->object.vm_object == NULL) {
vm_map_clip_start(map, entry, start);
- } else
- entry = vm_map_entry_succ(entry);
-
- vm_map_clip_end(map, entry, end);
-
- if ((entry->start == start) && (entry->end == end) &&
- ((entry->eflags & MAP_ENTRY_COW) == 0) &&
- (entry->object.vm_object == NULL)) {
+ vm_map_clip_end(map, entry, end);
entry->object.sub_map = submap;
entry->eflags |= MAP_ENTRY_IS_SUB_MAP;
result = KERN_SUCCESS;
More information about the svn-src-all
mailing list