Re: [PATCH] mm: use in_atomic() in print_vma_addr()

From: Peter Zijlstra
Date: Mon Nov 06 2017 - 07:00:39 EST


On Mon, Nov 06, 2017 at 11:43:54AM +0100, Michal Hocko wrote:
> > Yes the comment is very much accurate.
>
> Which suggests that print_vma_addr might be problematic, right?
> Shouldn't we do trylock on mmap_sem instead?

Yes that's complete rubbish. trylock will get spurious failures to print
when the lock is contended.

The right solution is to not call this thing when you can't schedule,
trying to divine the state in the print function is doomed to failure.