Debugging kernel semaphore contention and priority inversion

Davda, Bhavesh P (Bhavesh)
2005-08-17T22:54:25Z

Is there a way to know which task has a particular (struct semaphore *)
down()ed, leading to another task's down() blocking on it?

I'm trying to debug a priority inversion caused by potentially a real
low priority SCHED_OTHER task (potentially a kernel thread like
kjournald) holding an inode->i_sem semaphore for a file that is blocking
a write() from a high-priority (50) SCHED_FIFO task.

It would be helpful to get a kernel stacktrace for the culprit too.

Thanks

- Bhavesh

Ps: ideally I would like to do this from a module/probe I can insert in
a system that is stuck in this state, because I don't want to Heisenberg
the setup with a kdb or otherwise instrumented kernel.

Bhavesh P. Davda | Distinguished Member of Technical Staff | Avaya |
1300 West 120th Avenue | B3-B03 | Westminster, CO 80234 | U.S.A. |
Voice/Fax: 303.538.4438 | bhavesh@avaya.com