Hi,<div><br></div><div>i wrote a linux kernel module which uses mmap_sem in lots of places. I grab mmap_sem for both reads & writes. And, i also use page_table_lock spinlock under them. The problem i have is that there is a hard to reproduce a race condition bug in which a thread doesn't release the semaphore at all. Hence, ps hangs as ps needs to grab mmap_sem for the processes. The question is how do i find the thread that is holding the semaphore forever. It will help me figure out the part of the code the race is in. </div>
<div><br></div><div>So, the question is : I have some number of threads grabbing the semaphore for read/write. One of them grabs it & doesn't release at all. How do i find the thread that is holding it. This is not a soft lockup & i dont get any hung_task_timeout messages. </div>
<div><br></div><div>Any help is appreciated.</div><div><br></div><div>Thanks.</div><div><br></div><div>Venkatram</div>