-
Notifications
You must be signed in to change notification settings - Fork 407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IORING_SETUP_SQPOLL: Understanding behaviour of the kernel thread that never goes to sleep. #729
Comments
After preparing a request you have to call some variation of In your example, if you submitted all your requests prior to the first sleep and you find that it's sleeping after 5 second, it only means that the kernel has completed its job and has nothing to do. |
Thanks for the answer. Maybe I was not correctly explaining it the first time around.
I did. But I also received all responses before the first sleep. There is nothing to do in the SQ or to reap from the CQ. The bug/behavior I am hinting at is that the kernel thread continues to spin at 100% CPU if the application thread goes to sleep before the kernel thread has been put to sleep (the first snippet). So for the example:
My question is if my expectation is correct or if not then why? |
Ok, I see what you mean.
There is no relation. In both your examples the kernel thread should go to sleep shortly. There is certainly a bug somewhere if it doesn't. |
Sure. Here is the test program I was testing off. If it helps my kernel version is |
I wrote a small test program and ran it in 5.15-stable (5.15.19 to be specific), and it seems to behave like it should. I then ran your test program, and it also seems to behave like it should - the sqpoll thread goes to sleep after 2 seconds when it has no work left to do. I do have one box that's running 5.15.0-53-generic and I ran it there too and it behaved like it should too. I have no insight into the distro kernels, does it still keep spinning for you if you update to -53? |
Interesting. Ubuntu 20 doesn't seem to come with a stock version of the stable release. I am already sort of on the "bleeding edge"... I'm gonna patch it in a VM and try it out and report back. |
Okay so I repeated it with |
I think I inadvertently figured out what this is... Are you able to run self built 5.15-stable kernels? Or how can you test a fix? |
Awesome! |
Can you link me the commit for the 5.15 for testing. |
Interesting, what was that? Is the bug confirmed? |
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.In this situation from monitoring my CPU (using basic
htop
filtering) I notice that the kernel thread status continues to stayR
(running) and CPU usage is high. If I adjust the above snipped slightly.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?
The text was updated successfully, but these errors were encountered: