Always map the kernel itself using global pages.
This avoids TLB stalls after context switching, that are very visible from flamegraphs.
This commit is contained in:
@@ -35,7 +35,7 @@ unsafe fn page_flags<A: Arch>(virt: VirtualAddress) -> PageFlags<A> {
|
||||
use crate::kernel_executable_offsets::*;
|
||||
let virt_addr = virt.data();
|
||||
|
||||
if virt_addr >= __text_start() && virt_addr < __text_end() {
|
||||
(if virt_addr >= __text_start() && virt_addr < __text_end() {
|
||||
// Remap text read-only, execute
|
||||
PageFlags::new().execute(true)
|
||||
} else if virt_addr >= __rodata_start() && virt_addr < __rodata_end() {
|
||||
@@ -44,7 +44,8 @@ unsafe fn page_flags<A: Arch>(virt: VirtualAddress) -> PageFlags<A> {
|
||||
} else {
|
||||
// Remap everything else read-write, no execute
|
||||
PageFlags::new().write(true)
|
||||
}
|
||||
})
|
||||
.global(cfg!(not(feature = "pti")))
|
||||
}
|
||||
|
||||
unsafe fn inner(
|
||||
|
||||
Reference in New Issue
Block a user