]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
vm: improve kstack_object pindex calculation to avoid pindex holes
authorBojan Novković <bnovkov@FreeBSD.org>
Tue, 9 Apr 2024 19:02:12 +0000 (21:02 +0200)
committerBojan Novković <bnovkov@FreeBSD.org>
Wed, 10 Apr 2024 15:37:20 +0000 (17:37 +0200)
commit7a79d066976149349ecb90240d02eed0c4268737
tree23739794173dbf11b1753ebda869dece15e56974
parent014d7082a2398ec39e76b5f7b1f842fc9be6c51e
vm: improve kstack_object pindex calculation to avoid pindex holes

This commit replaces the linear transformation of kernel virtual
addresses to kstack_object pindex values with a non-linear
scheme that circumvents physical memory fragmentation caused by
kernel stack guard pages. The new mapping scheme is used to
effectively "skip" guard pages and assign pindices for
non-guard pages in a contiguous fashion.

The new allocation scheme requires that all default-sized kstack KVAs
come from a separate, specially aligned region of the KVA space.
For this to work, this commited introduces a dedicated per-domain
kstack KVA arena used to allocate kernel stacks of default size.
The behaviour on 32-bit platforms remains unchanged due to a
significatly smaller KVA space.

Aside from fullfilling the requirements imposed by the new scheme, a
separate kstack KVA arena facilitates superpage promotion in the rest
of kernel and causes most kstacks to have guard pages at both ends.

Reviewed by:  alc, kib, markj
Tested by:    markj
Approved by:  markj (mentor)
Differential Revision: https://reviews.freebsd.org/D38852
sys/sys/proc.h
sys/vm/vm_extern.h
sys/vm/vm_glue.c
sys/vm/vm_kern.h
sys/vm/vm_swapout.c