mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-05 01:55:21 +03:00
Kernel/x86: Re-enable interrupts ASAP when handling page faults
As soon as we've saved CR2 (the faulting address), we can re-enable interrupt processing. This should make the kernel more responsive under heavy fault loads.
This commit is contained in:
parent
037f1ae979
commit
a84d893af8
Notes:
sideshowbarker
2024-07-17 11:30:05 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/a84d893af8
@ -254,8 +254,12 @@ void page_fault_handler(TrapFrame* trap)
|
||||
{
|
||||
clac();
|
||||
|
||||
auto& regs = *trap->regs;
|
||||
// NOTE: Once we've extracted the faulting address from CR2,
|
||||
// we can re-enable interrupts.
|
||||
auto fault_address = read_cr2();
|
||||
sti();
|
||||
|
||||
auto& regs = *trap->regs;
|
||||
|
||||
if constexpr (PAGE_FAULT_DEBUG) {
|
||||
u32 fault_page_directory = read_cr3();
|
||||
|
@ -317,7 +317,6 @@ size_t AnonymousVMObject::cow_pages() const
|
||||
|
||||
PageFaultResponse AnonymousVMObject::handle_cow_fault(size_t page_index, VirtualAddress vaddr)
|
||||
{
|
||||
VERIFY_INTERRUPTS_DISABLED();
|
||||
SpinlockLocker lock(m_lock);
|
||||
|
||||
if (is_volatile()) {
|
||||
|
@ -715,8 +715,6 @@ Region* MemoryManager::find_region_from_vaddr(VirtualAddress vaddr)
|
||||
|
||||
PageFaultResponse MemoryManager::handle_page_fault(PageFault const& fault)
|
||||
{
|
||||
VERIFY_INTERRUPTS_DISABLED();
|
||||
|
||||
auto faulted_in_range = [&fault](auto const* start, auto const* end) {
|
||||
return fault.vaddr() >= VirtualAddress { start } && fault.vaddr() < VirtualAddress { end };
|
||||
};
|
||||
|
@ -402,7 +402,6 @@ PageFaultResponse Region::handle_fault(PageFault const& fault)
|
||||
|
||||
PageFaultResponse Region::handle_zero_fault(size_t page_index_in_region)
|
||||
{
|
||||
VERIFY_INTERRUPTS_DISABLED();
|
||||
VERIFY(vmobject().is_anonymous());
|
||||
|
||||
SpinlockLocker locker(vmobject().m_lock);
|
||||
@ -444,7 +443,6 @@ PageFaultResponse Region::handle_zero_fault(size_t page_index_in_region)
|
||||
|
||||
PageFaultResponse Region::handle_cow_fault(size_t page_index_in_region)
|
||||
{
|
||||
VERIFY_INTERRUPTS_DISABLED();
|
||||
auto current_thread = Thread::current();
|
||||
if (current_thread)
|
||||
current_thread->did_cow_fault();
|
||||
@ -461,7 +459,6 @@ PageFaultResponse Region::handle_cow_fault(size_t page_index_in_region)
|
||||
|
||||
PageFaultResponse Region::handle_inode_fault(size_t page_index_in_region)
|
||||
{
|
||||
VERIFY_INTERRUPTS_DISABLED();
|
||||
VERIFY(vmobject().is_inode());
|
||||
VERIFY(!s_mm_lock.is_locked_by_current_processor());
|
||||
VERIFY(!g_scheduler_lock.is_locked_by_current_processor());
|
||||
|
Loading…
Reference in New Issue
Block a user