diff --git a/src/arch/aarch64/interrupt/irq.rs b/src/arch/aarch64/interrupt/irq.rs index 21e5c4a2f0..750183602a 100644 --- a/src/arch/aarch64/interrupt/irq.rs +++ b/src/arch/aarch64/interrupt/irq.rs @@ -59,7 +59,8 @@ pub unsafe fn irq_handler_gentimer(irq: u32) { timeout::trigger(); - if PIT_TICKS.fetch_add(1, Ordering::SeqCst) >= 10 { + // Switch after 3 ticks (about 6.75 ms) + if PIT_TICKS.fetch_add(1, Ordering::SeqCst) >= 2 { let _ = context::switch(); } trigger(irq); diff --git a/src/arch/x86/interrupt/ipi.rs b/src/arch/x86/interrupt/ipi.rs index 52aad2abe4..fd70507aca 100644 --- a/src/arch/x86/interrupt/ipi.rs +++ b/src/arch/x86/interrupt/ipi.rs @@ -24,7 +24,8 @@ interrupt!(switch, || { interrupt!(pit, || { LOCAL_APIC.eoi(); - if PIT_TICKS.fetch_add(1, Ordering::SeqCst) >= 10 { + // Switch after 3 ticks (about 6.75 ms) + if PIT_TICKS.fetch_add(1, Ordering::SeqCst) >= 2 { let _ = context::switch(); } }); diff --git a/src/arch/x86/interrupt/irq.rs b/src/arch/x86/interrupt/irq.rs index c36844a111..497053f53c 100644 --- a/src/arch/x86/interrupt/irq.rs +++ b/src/arch/x86/interrupt/irq.rs @@ -189,7 +189,8 @@ interrupt_stack!(pit_stack, |_stack| { // Any better way of doing this? timeout::trigger(); - if PIT_TICKS.fetch_add(1, Ordering::SeqCst) >= 10 { + // Switch after 3 ticks (about 6.75 ms) + if PIT_TICKS.fetch_add(1, Ordering::SeqCst) >= 2 { let _ = context::switch(); } }); diff --git a/src/arch/x86_64/interrupt/ipi.rs b/src/arch/x86_64/interrupt/ipi.rs index 52aad2abe4..fd70507aca 100644 --- a/src/arch/x86_64/interrupt/ipi.rs +++ b/src/arch/x86_64/interrupt/ipi.rs @@ -24,7 +24,8 @@ interrupt!(switch, || { interrupt!(pit, || { LOCAL_APIC.eoi(); - if PIT_TICKS.fetch_add(1, Ordering::SeqCst) >= 10 { + // Switch after 3 ticks (about 6.75 ms) + if PIT_TICKS.fetch_add(1, Ordering::SeqCst) >= 2 { let _ = context::switch(); } }); diff --git a/src/arch/x86_64/interrupt/irq.rs b/src/arch/x86_64/interrupt/irq.rs index c36844a111..497053f53c 100644 --- a/src/arch/x86_64/interrupt/irq.rs +++ b/src/arch/x86_64/interrupt/irq.rs @@ -189,7 +189,8 @@ interrupt_stack!(pit_stack, |_stack| { // Any better way of doing this? timeout::trigger(); - if PIT_TICKS.fetch_add(1, Ordering::SeqCst) >= 10 { + // Switch after 3 ticks (about 6.75 ms) + if PIT_TICKS.fetch_add(1, Ordering::SeqCst) >= 2 { let _ = context::switch(); } });