Date: Mon, 9 Dec 2024 03:28:37 GMT From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: d939fd2d4512 - main - vm_map: convert several bool members into flags Message-ID: <202412090328.4B93Sbdt083869@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d939fd2d4512c9811246834a19946f69350764e0 commit d939fd2d4512c9811246834a19946f69350764e0 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2024-12-06 23:52:25 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2024-12-09 03:27:44 +0000 vm_map: convert several bool members into flags Extend flags to u_int. Move system_map and needs_wakeup bools into flags. Reviewed by: alc Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D47934 --- sys/vm/vm_kern.c | 6 +++--- sys/vm/vm_map.c | 6 ++---- sys/vm/vm_map.h | 12 ++++++------ 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/sys/vm/vm_kern.c b/sys/vm/vm_kern.c index 29a64a0fe6d8..86ab2529e27f 100644 --- a/sys/vm/vm_kern.c +++ b/sys/vm/vm_kern.c @@ -724,7 +724,7 @@ kmap_alloc_wait(vm_map_t map, vm_size_t size) swap_release(size); return (0); } - map->needs_wakeup = TRUE; + vm_map_modflags(map, MAP_NEEDS_WAKEUP, 0); vm_map_unlock_and_wait(map, 0); } vm_map_insert(map, NULL, 0, addr, addr + size, VM_PROT_RW, VM_PROT_RW, @@ -745,8 +745,8 @@ kmap_free_wakeup(vm_map_t map, vm_offset_t addr, vm_size_t size) vm_map_lock(map); (void) vm_map_delete(map, trunc_page(addr), round_page(addr + size)); - if (map->needs_wakeup) { - map->needs_wakeup = FALSE; + if ((map->flags & MAP_NEEDS_WAKEUP) != 0) { + vm_map_modflags(map, 0, MAP_NEEDS_WAKEUP); vm_map_wakeup(map); } vm_map_unlock(map); diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index f7847a244586..564ef59950e4 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -292,7 +292,7 @@ vmspace_zinit(void *mem, int size, int flags) vm = (struct vmspace *)mem; map = &vm->vm_map; - memset(map, 0, sizeof(*map)); /* set map->system_map = false */ + memset(map, 0, sizeof(*map)); /* set MAP_SYSTEM_MAP to false */ sx_init(&map->lock, "vm map (user)"); PMAP_LOCK_INIT(vmspace_pmap(vm)); return (0); @@ -886,7 +886,6 @@ _vm_map_init(vm_map_t map, pmap_t pmap, vm_offset_t min, vm_offset_t max) { map->header.eflags = MAP_ENTRY_HEADER; - map->needs_wakeup = FALSE; map->pmap = pmap; map->header.end = min; map->header.start = max; @@ -905,7 +904,6 @@ void vm_map_init(vm_map_t map, pmap_t pmap, vm_offset_t min, vm_offset_t max) { _vm_map_init(map, pmap, min, max); - map->system_map = false; sx_init(&map->lock, "vm map (user)"); } @@ -913,7 +911,7 @@ void vm_map_init_system(vm_map_t map, pmap_t pmap, vm_offset_t min, vm_offset_t max) { _vm_map_init(map, pmap, min, max); - map->system_map = true; + vm_map_modflags(map, MAP_SYSTEM_MAP, 0); mtx_init(&map->system_mtx, "vm map (system)", NULL, MTX_DEF | MTX_DUPOK); } diff --git a/sys/vm/vm_map.h b/sys/vm/vm_map.h index caed29bd23cf..9645ae1a0527 100644 --- a/sys/vm/vm_map.h +++ b/sys/vm/vm_map.h @@ -210,9 +210,7 @@ struct vm_map { int nentries; /* Number of entries */ vm_size_t size; /* virtual size */ u_int timestamp; /* Version number */ - u_char needs_wakeup; - u_char system_map; /* (c) Am I a system map? */ - vm_flags_t flags; /* flags for this vm_map */ + u_int flags; /* flags for this vm_map */ vm_map_entry_t root; /* Root of a binary search tree */ pmap_t pmap; /* (c) Physical map */ vm_offset_t anon_loc; @@ -223,7 +221,7 @@ struct vm_map { }; /* - * vm_flags_t values + * vm_map flags values */ #define MAP_WIREFUTURE 0x00000001 /* wire all future pages */ #define MAP_BUSY_WAKEUP 0x00000002 /* thread(s) waiting on busy @@ -236,6 +234,8 @@ struct vm_map { #define MAP_WXORX 0x00000040 /* enforce W^X */ #define MAP_ASLR_STACK 0x00000080 /* stack location is randomized */ +#define MAP_NEEDS_WAKEUP 0x40000000 +#define MAP_SYSTEM_MAP 0x80000000 #ifdef _KERNEL #if defined(KLD_MODULE) && !defined(KLD_TIED) @@ -266,7 +266,7 @@ vm_map_pmap(vm_map_t map) } static __inline void -vm_map_modflags(vm_map_t map, vm_flags_t set, vm_flags_t clear) +vm_map_modflags(vm_map_t map, u_int set, u_int clear) { map->flags = (map->flags | set) & ~clear; } @@ -284,7 +284,7 @@ vm_map_range_valid(vm_map_t map, vm_offset_t start, vm_offset_t end) static inline bool vm_map_is_system(vm_map_t map) { - return ((map->system_map)); + return ((map->flags & MAP_SYSTEM_MAP) != 0); } #endif /* KLD_MODULE */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202412090328.4B93Sbdt083869>