From nobody Mon Dec 09 03:28:37 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y66lT5cJBz5g7c4; Mon, 09 Dec 2024 03:28:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y66lT3cgbz44jy; Mon, 9 Dec 2024 03:28:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733714917; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=uZIn5HbBTPa+zOlMQz5/NqTvFnDmi4N5j2zfcIxy03o=; b=ySWsV+w5hQHbib4Q2Z33zRZvbZ4/AbMDyKfq0lD8XNihT/P9wX1acI1JaLIwLL4wRfcMtN tORSdfxahAOPst9pE4ltfQfkfHGJRIwNCJFma/DhJUKvCBgPP4ArpUpdCDmCByXca39Ttc 57Cs3GVMiXKDdsW7483Qy/Y36ZQwtXWfTOqbeYARWyS5hTfUUasAAOeXYBR+s/ekXcXbaR CKPk7lZa7QanmlE9KPZ5/nwuVdZYwiyF3v+Wysr0NZ442Hl431zPZ5kAeqmcSSXHa5enxa bHsYH8WWON4O1ATEnyZTKyrfvyDf1Dauz0rSrS9Z5JdxHvyQrNlfW/E2Bx+Vqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733714917; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=uZIn5HbBTPa+zOlMQz5/NqTvFnDmi4N5j2zfcIxy03o=; b=o/OFsqb9mH0qvt1hnHSUqlWgy5POcz4ZdOyREdtBmc+lBzf3eo7g88SBaUVQuAQ/esOeS8 IxEd8PhVBNrI0wX6LH+UjCN3QFsnBwO5VgblkUe7FKK8gey3FPEURcZ3htcCMj46ZyMaSo aBoBS1k78VO2cZspyQPgDZqHTxQ69jkJs7uEhqwpZAm94Qf7czEMkpUqq2sdoPRHhBAXRu /MaTQsnK8J3t3UHzTtU8yIfr2jhZzz2dyB0ghn251sBmL6nmtAfxKqwAWoL8efGx2inF5y ilDwyozBqf2tCb6lq9hiOQxTdeKhQv4j4FCConm3zEWDx+RoyxluNid3wgUCtw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733714917; a=rsa-sha256; cv=none; b=StzHzYDjITP5xYmYQAoq/mmg9aArfFYOnHArOCCSsLfGLLQBqw/SebQ+BLyRZKYA54xoZe BmSm+JXli8jzXLClGeH7yj2ms8R+RJNOenyOyisrK8oEmhLPDAhQi/k9Kych5rI9WsRGlU 3nFCov+6Hmuov8H3dMl39+L7/inpdAI086mfbR3pVaO4N1F8d/UP+LDGAlIyHCb4IBkW3/ TQhI5ji9s6u/7riZhMwsYDQXDs+dmIclppB82roAuPWwdivZUniQSJHXQw0xhBF6t1VwZC igSqL42LZe/OyWiUfH/rA6lrnXR+Uq49MLnPhDDBCZy0l+5YLl1UD68C5HeXmw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Y66lT1qGtzLTF; Mon, 9 Dec 2024 03:28:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B93SbTp083872; Mon, 9 Dec 2024 03:28:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B93Sbdt083869; Mon, 9 Dec 2024 03:28:37 GMT (envelope-from git) Date: Mon, 9 Dec 2024 03:28:37 GMT Message-Id: <202412090328.4B93Sbdt083869@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: d939fd2d4512 - main - vm_map: convert several bool members into flags List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d939fd2d4512c9811246834a19946f69350764e0 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d939fd2d4512c9811246834a19946f69350764e0 commit d939fd2d4512c9811246834a19946f69350764e0 Author: Konstantin Belousov AuthorDate: 2024-12-06 23:52:25 +0000 Commit: Konstantin Belousov 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 */