People often ask me "How did you learn how to hack?" The answer: by reading. This page is a collection of the blog posts and other articles that I have accumulated over the years of my journey. Enjoy!
remove_waiter() was written for a single scenario: a thread that blocks on its own, then cleans up after itself. To do this, it's always assumed that the current is the thread that needs to be cleaned up, and clears current->pi_blocked_on. Requeue-PI broke this assumption. In rt_mutex_start_proxy_lock(), the helper is used to clean up on behalf of a different, sleeping thread. Current is the thread that was issued, rather than the actual waiting thread. When there's a potential deadlock, the code rolls back via remove_waiter(). This leads to the function removing the wrong task!