Re: [PATCH v3 6/6] pid: drop irq disablement around pidmap_lock

Oleg Nesterov
2025-02-01T17:46:19Z

On 02/01, Oleg Nesterov wrote:
>
> However, shouldn't this patch also remove the comment which explains
> the possible lock inversion? Above put_pid(),
>
> /*
> * Note: disable interrupts while the pidmap_lock is held as an
> * interrupt might come in and do read_lock(&tasklist_lock).
> *
> * If we don't disable interrupts there is a nasty deadlock between
> * detach_pid()->free_pid() and another cpu that does
> * spin_lock(&pidmap_lock) followed by an interrupt routine that does
> * read_lock(&tasklist_lock);
> *
> * After we clean up the tasklist_lock and know there are no
> * irq handlers that take it we can leave the interrupts enabled.
> * For now it is easier to be safe than to prove it can't happen.
> */

Ah, sorry, please forget, you did it in the previous patch. which probably
needs some more discussion...

Oleg.