-
Notifications
You must be signed in to change notification settings - Fork 507
IORING_SETUP_SQPOLL: Understanding behaviour of the kernel thread that never goes to sleep. #729
Copy link
Copy link
Closed
Description
I was running one of the examples from loiu wiki. I was trying out kernel-side polling which can be quite efficient for our use case. Consider this tiny snippet. It pretty much follows from the example above apart from the addition of the sleep call.
params.flags |= IORING_SETUP_SQPOLL;
params.sq_thread_idle = 2000; // should wait for 2 second idle time.
// I/O logic. Usually lasts less than 2 seconds.
sleep(1000); // calling thread goes to sleep before kernel thread can go to sleep.In this situation from monitoring my CPU (using basic htop filtering) I notice that the kernel thread status continues to stay R (running) and CPU usage is high. If I adjust the above snipped slightly.
params.flags |= IORING_SETUP_SQPOLL;
params.sq_thread_idle = 2000; // should wait for 2 second idle time.
// I/O logic. Usually lasts less than 2 seconds.
sleep(5); // An additional sleep call. At the end of this the kernel thread should have expired its timeout.
sleep(1000); // this time calling thread goes to sleep after kernel thread has expired the idle timeout.The kernel thread goes to sleep after the first sleep returns. I am wondering what should be the relation b/w the calling thread being awake when the kernel thread needs to go back to sleep.
The question is simple. Is this a requirement of the API that I am unaware of or is this a bug?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels