Page MenuHomeFreeBSD

vm_map_submap(): Avoid unnecessary clipping.
ClosedPublic

Authored by markj on Jan 21 2020, 3:41 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Jan 21, 4:13 AM
Unknown Object (File)
Dec 2 2024, 7:56 PM
Unknown Object (File)
Nov 21 2024, 2:22 AM
Unknown Object (File)
Nov 13 2024, 11:31 AM
Unknown Object (File)
Nov 6 2024, 1:32 PM
Unknown Object (File)
Oct 26 2024, 3:22 PM
Unknown Object (File)
Oct 18 2024, 2:07 AM
Unknown Object (File)
Oct 1 2024, 2:51 PM

Details

Summary

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".

I don't think this represents any functional change since we only use
submaps in one place, and that is unaffected.

This is based on a patch submitted by Wuyang Chung.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sys/vm/vm_map.c
2485 ↗(On Diff #67103)

Doesn't the 'end' test in line 2481 ensure that this line does nothing? It doesn't seem to represent the test "the returned entry contains end".

sys/vm/vm_map.c
2485 ↗(On Diff #67103)

I don't quite follow: we can't treat the entry as a submap if it doesn't contain "end", but before turning into a submap we must clip it to ensure that it does not extend beyond "end".

sys/vm/vm_map.c
2485 ↗(On Diff #67103)

vm_map_clip_end:

if ((endaddr) < (entry->end)) \ ...

but line 2481 ensures that we get here only if entry->end <= end. So vm_map_clip_end is a no-op.

I'm have no view on what submaps should or should not do. I'm just trying to understand why clip-end needs to be called when the need to clip has been ruled out already.

Fix a backwards comparison.

sys/vm/vm_map.c
2485 ↗(On Diff #67103)

Sorry, I see now. The comparison is backwards. I'm not sure how I was able to boot with the original patch.

This revision is now accepted and ready to land.Jan 21 2020, 7:45 PM
This revision was automatically updated to reflect the committed changes.