Re: [RFC 06/10] Reclaim memory from blocked kernel stacks
From: Sebastian Andrzej Siewior
Date: Mon Aug 31 2026 - 03:39:50 EST
On 2026-08-29 15:49:22 [+0100], Matthew Wilcox wrote:
> On Sat, Aug 29, 2026 at 10:49:01AM +0200, Peter Zijlstra wrote:
> > > On PREEMPT_RT, it is necessary to skip the call to
> > > alloc_pages_nolock_noprof() from under pi_lock, since with that
> > > configuration spin_trylock can end up needing to take pi_lock. But at
> > > least on !PREEMPT_RT, there is no risk of deadlock.
> >
> > Yeah, which puts the lie to that horrific hack Alexei did. We should
> > probably teach lockdep about spin_trylock() not being safe and see the
> > house of cards crumble.
>
> Why is spin_trylock() unsafe on PREEMPT_RT? It's not intuitive since
> one can mutex_trylock() in interrupt context or under spinlock.
no, you shouldn't do mutex_trylock() in IRQ. There was something, I
don't remember but that is the reason people use semaphores because it
is okay to do down_trylock() in IRQ. It might be unlock path.
Sebastian