git: 235750ee5130 - main - vm: Remove kernel stack swapping support, part 8
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 29 Jul 2024 01:50:00 UTC
The branch main has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=235750ee5130aa71cf4151457435e806dd58f2ec
commit 235750ee5130aa71cf4151457435e806dd58f2ec
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-07-29 01:41:26 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-07-29 01:43:59 +0000
vm: Remove kernel stack swapping support, part 8
- The kernel stack objects do not need to be pageable, so use OBJT_PHYS
objects instead. The main difference is that mappings do not require
PV entries.
- Make some externally visible functions, relating to kernel thread
stack internals, private to vm_glue.c, as their external consumers are
now gone.
Tested by: pho
Reviewed by: alc, kib
Differential Revision: https://reviews.freebsd.org/D46119
---
sys/vm/vm_extern.h | 4 ----
sys/vm/vm_glue.c | 17 ++++++++++-------
2 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/sys/vm/vm_extern.h b/sys/vm/vm_extern.h
index 8c9addda1196..93ec6014c27d 100644
--- a/sys/vm/vm_extern.h
+++ b/sys/vm/vm_extern.h
@@ -127,10 +127,6 @@ struct sf_buf *vm_imgact_map_page(vm_object_t object, vm_ooffset_t offset);
void vm_imgact_unmap_page(struct sf_buf *sf);
void vm_thread_dispose(struct thread *td);
int vm_thread_new(struct thread *td, int pages);
-vm_pindex_t vm_kstack_pindex(vm_offset_t ks, int npages);
-vm_object_t vm_thread_kstack_size_to_obj(int npages);
-int vm_thread_stack_back(vm_offset_t kaddr, vm_page_t ma[], int npages,
- int req_class, int domain);
u_int vm_active_count(void);
u_int vm_inactive_count(void);
u_int vm_laundry_count(void);
diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c
index 63417687a1a5..2627ee75dbff 100644
--- a/sys/vm/vm_glue.c
+++ b/sys/vm/vm_glue.c
@@ -56,7 +56,6 @@
* rights to redistribute these changes.
*/
-#include <sys/cdefs.h>
#include "opt_vm.h"
#include "opt_kstack_pages.h"
#include "opt_kstack_max_pages.h"
@@ -101,7 +100,6 @@
#include <vm/vm_kern.h>
#include <vm/vm_extern.h>
#include <vm/vm_pager.h>
-#include <vm/swap_pager.h>
#include <vm/vm_phys.h>
#include <machine/cpu.h>
@@ -280,6 +278,11 @@ static uma_zone_t kstack_cache;
static int kstack_cache_size;
static vmem_t *vmd_kstack_arena[MAXMEMDOM];
+static vm_pindex_t vm_kstack_pindex(vm_offset_t ks, int npages);
+static vm_object_t vm_thread_kstack_size_to_obj(int npages);
+static int vm_thread_stack_back(vm_offset_t kaddr, vm_page_t ma[], int npages,
+ int req_class, int domain);
+
static int
sysctl_kstack_cache_size(SYSCTL_HANDLER_ARGS)
{
@@ -577,7 +580,7 @@ vm_thread_dispose(struct thread *td)
* Uses a non-identity mapping if guard pages are
* active to avoid pindex holes in the kstack object.
*/
-vm_pindex_t
+static vm_pindex_t
vm_kstack_pindex(vm_offset_t ks, int kpages)
{
vm_pindex_t pindex = atop(ks - VM_MIN_KERNEL_ADDRESS);
@@ -604,7 +607,7 @@ vm_kstack_pindex(vm_offset_t ks, int kpages)
* Allocate physical pages, following the specified NUMA policy, to back a
* kernel stack.
*/
-int
+static int
vm_thread_stack_back(vm_offset_t ks, vm_page_t ma[], int npages, int req_class,
int domain)
{
@@ -643,7 +646,7 @@ cleanup:
return (ENOMEM);
}
-vm_object_t
+static vm_object_t
vm_thread_kstack_size_to_obj(int npages)
{
return (npages == kstack_pages ? kstack_object : kstack_alt_object);
@@ -686,7 +689,7 @@ kstack_cache_init(void *null)
vm_size_t kstack_quantum;
int domain;
- kstack_object = vm_object_allocate(OBJT_SWAP,
+ kstack_object = vm_object_allocate(OBJT_PHYS,
atop(VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS));
kstack_cache = uma_zcache_create("kstack_cache",
kstack_pages * PAGE_SIZE, NULL, NULL, NULL, NULL,
@@ -695,7 +698,7 @@ kstack_cache_init(void *null)
kstack_cache_size = imax(128, mp_ncpus * 4);
uma_zone_set_maxcache(kstack_cache, kstack_cache_size);
- kstack_alt_object = vm_object_allocate(OBJT_SWAP,
+ kstack_alt_object = vm_object_allocate(OBJT_PHYS,
atop(VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS));
kstack_quantum = vm_thread_kstack_import_quantum();