Re: [PATCH 5/7] mm/page_alloc: Protect PCP lists with a spinlock

From: Mel Gorman
Date: Tue Jul 05 2022 - 03:20:46 EST


On Mon, Jul 04, 2022 at 02:31:17PM +0200, Vlastimil Babka wrote:
> On 6/24/22 14:54, Mel Gorman wrote:
> > Currently the PCP lists are protected by using local_lock_irqsave to
> > prevent migration and IRQ reentrancy but this is inconvenient. Remote
> > draining of the lists is impossible and a workqueue is required and every
> > task allocation/free must disable then enable interrupts which is
> > expensive.
> >
> > As preparation for dealing with both of those problems, protect the lists
> > with a spinlock. The IRQ-unsafe version of the lock is used because IRQs
> > are already disabled by local_lock_irqsave. spin_trylock is used in
> > preparation for a time when local_lock could be used instead of
> > lock_lock_irqsave.
>
> ^ local_lock_irqsave?
>

More appropriate given how the series evolved would be;

spin_trylock is used in combination with local_lock_irqsave() but later
will be replaced with a spin_trylock_irqsave when the local_lock is
removed.

--
Mel Gorman
SUSE Labs