git: d0e4e53ebd64 - main - vm_map: Add a macro to fetch a map entry's split boundary index
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 01 Aug 2023 14:13:03 UTC
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=d0e4e53ebd6499d420c19426586eeeafec157150 commit d0e4e53ebd6499d420c19426586eeeafec157150 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2023-05-09 14:07:15 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2023-08-01 14:10:02 +0000 vm_map: Add a macro to fetch a map entry's split boundary index The resulting code is a bit more concise. No functional change intended. Reviewed by: alc, dougm, kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D41249 --- sys/vm/vm_fault.c | 3 +-- sys/vm/vm_map.c | 13 ++++--------- sys/vm/vm_map.h | 4 +++- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index 8b4b8ebb7375..458772d976fc 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -539,8 +539,7 @@ vm_fault_populate(struct faultstate *fs) MPASS(pager_last < fs->first_object->size); vm_fault_restore_map_lock(fs); - bdry_idx = (fs->entry->eflags & MAP_ENTRY_SPLIT_BOUNDARY_MASK) >> - MAP_ENTRY_SPLIT_BOUNDARY_SHIFT; + bdry_idx = MAP_ENTRY_SPLIT_BOUNDARY_INDEX(fs->entry); if (fs->map->timestamp != fs->map_generation) { if (bdry_idx == 0) { vm_fault_populate_cleanup(fs->first_object, pager_first, diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index eb607d519247..8ab38ae2a087 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -2449,8 +2449,7 @@ vm_map_clip_start(vm_map_t map, vm_map_entry_t entry, vm_offset_t startaddr) KASSERT(entry->end > startaddr && entry->start < startaddr, ("%s: invalid clip of entry %p", __func__, entry)); - bdry_idx = (entry->eflags & MAP_ENTRY_SPLIT_BOUNDARY_MASK) >> - MAP_ENTRY_SPLIT_BOUNDARY_SHIFT; + bdry_idx = MAP_ENTRY_SPLIT_BOUNDARY_INDEX(entry); if (bdry_idx != 0) { if ((startaddr & (pagesizes[bdry_idx] - 1)) != 0) return (KERN_INVALID_ARGUMENT); @@ -2523,8 +2522,7 @@ vm_map_clip_end(vm_map_t map, vm_map_entry_t entry, vm_offset_t endaddr) KASSERT(entry->start < endaddr && entry->end > endaddr, ("%s: invalid clip of entry %p", __func__, entry)); - bdry_idx = (entry->eflags & MAP_ENTRY_SPLIT_BOUNDARY_MASK) >> - MAP_ENTRY_SPLIT_BOUNDARY_SHIFT; + bdry_idx = MAP_ENTRY_SPLIT_BOUNDARY_INDEX(entry); if (bdry_idx != 0) { if ((endaddr & (pagesizes[bdry_idx] - 1)) != 0) return (KERN_INVALID_ARGUMENT); @@ -3516,8 +3514,7 @@ vm_map_wire_locked(vm_map_t map, vm_offset_t start, vm_offset_t end, int flags) saved_start = entry->start; saved_end = entry->end; last_timestamp = map->timestamp; - bidx = (entry->eflags & MAP_ENTRY_SPLIT_BOUNDARY_MASK) - >> MAP_ENTRY_SPLIT_BOUNDARY_SHIFT; + bidx = MAP_ENTRY_SPLIT_BOUNDARY_INDEX(entry); incr = pagesizes[bidx]; vm_map_busy(map); vm_map_unlock(map); @@ -3715,9 +3712,7 @@ vm_map_sync( vm_map_unlock_read(map); return (KERN_INVALID_ARGUMENT); } - bdry_idx = (entry->eflags & - MAP_ENTRY_SPLIT_BOUNDARY_MASK) >> - MAP_ENTRY_SPLIT_BOUNDARY_SHIFT; + bdry_idx = MAP_ENTRY_SPLIT_BOUNDARY_INDEX(entry); if (bdry_idx != 0 && ((start & (pagesizes[bdry_idx] - 1)) != 0 || (end & (pagesizes[bdry_idx] - 1)) != 0)) { diff --git a/sys/vm/vm_map.h b/sys/vm/vm_map.h index c4ed36ce57ba..b974f52e51ed 100644 --- a/sys/vm/vm_map.h +++ b/sys/vm/vm_map.h @@ -154,8 +154,10 @@ struct vm_map_entry { #define MAP_ENTRY_HEADER 0x00080000 #define MAP_ENTRY_SPLIT_BOUNDARY_MASK 0x00300000 - #define MAP_ENTRY_SPLIT_BOUNDARY_SHIFT 20 +#define MAP_ENTRY_SPLIT_BOUNDARY_INDEX(entry) \ + (((entry)->eflags & MAP_ENTRY_SPLIT_BOUNDARY_MASK) >> \ + MAP_ENTRY_SPLIT_BOUNDARY_SHIFT) #ifdef _KERNEL static __inline u_char