Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to easily determine if a function could sleep in the Linux Kernel?

As I understand, inside interrupt context we should not call functions that could sleep.

So, is there a documentation, convention, clues or any easy way to determine if some function in the kernel could sleep?

like image 230
Reflection Avatar asked Sep 01 '25 05:09

Reflection


1 Answers

One major hint is a call to might_sleep, which most core kernel functions call as a way of catching bogus callers early on. You can also look for calls to schedule and its variants.

like image 130
mgalgs Avatar answered Sep 02 '25 19:09

mgalgs