From f4d5555d02144357d2e879e2214966ccbe0d0435 Mon Sep 17 00:00:00 2001 From: Aelin Reidel Date: Wed, 3 Jun 2026 13:31:44 +0200 Subject: [PATCH] perf(network): toggle polling mode conditionally Currently mostly an experiment. --- src/executor/network.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/executor/network.rs b/src/executor/network.rs index 5750e81378..c38525808b 100644 --- a/src/executor/network.rs +++ b/src/executor/network.rs @@ -260,7 +260,17 @@ async fn network_run() { if nic.poll_common(now) == PollResult::SocketStateChanged || cfg!(feature = "idle-poll") { // Progress was made or we want to poll when idle. + // This will result in the task getting polled again the next + // time the kernel is entered cx.waker().wake_by_ref(); + // Enter polling mode temporarily + // FIXME: maybe not on every state change + nic.set_polling_mode(true); + // FIXME: Maybe use a different source + // Set a timer for 1 second to ensure we end up in the kernel + // again in the next second to poll the interface once + create_timer(Source::Network, 1000 * 1000); + trace!("Enabled polling mode and configured network interrupt for 1 second"); } else { // Very likely no progress can be made, so set up a timer interrupt to wake the waker NETWORK_WAKER.lock().register(cx.waker());