Re: [PATCH 1/2] mm/page_alloc: don't spin_trylock() in NMI on UP
Andrew Morton <[email protected]>
| Newsgroups | dev.linux.lists.linux-rt-devel,org.kernel.vger.linux-kernel,org.kernel.vger.stable,org.kvack.linux-mm |
|---|---|
| Message-ID | <[email protected]> |
On Fri, 10 Jul 2026 10:42:20 +0000 Brendan Jackman <[email protected]> wrote: > As noted in can_spin_trylock(), using this is unsafe in this context. > commit 620b46ed6ae17 ("mm/page_alloc: return NULL early from > alloc_frozen_pages_nolock() in NMI on UP") fixed this on the alloc side > but missed the free side. > > Reported-by: [email protected] > Link: https://sashiko.dev/#/patchset/[email protected] > Cc: [email protected] > Fixes: d7242af86434 ("mm: Introduce alloc_frozen_pages_nolock()") Is this correct? I'm not seeing anything in that commit which could have caused this? > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -2979,8 +2979,7 @@ static void __free_frozen_pages(struct page *page, unsigned int order, > migratetype = MIGRATE_MOVABLE; > } > > - if (unlikely((fpi_flags & FPI_TRYLOCK) && IS_ENABLED(CONFIG_PREEMPT_RT) > - && (in_nmi() || in_hardirq()))) { > + if (unlikely((fpi_flags & FPI_TRYLOCK) && !can_spin_trylock())) { > add_page_to_zone_llist(zone, page, order); > return; > } It would be nice to include a description of the userspace impact. I'm suspecting that's "none known", but some speculation on what might happen to someone is appropriate. Also, please let's not combine a cc:stable bugfix with a minor macro renaming. They're very different things and will take quite different paths into mainline and -stable kernels. Also, Sashiko might have found yet more pre-existing issues: https://sashiko.dev/#/patchset/[email protected]