Re: [RFC PATCH 3/4] mm/page_alloc: introduce __GFP_PTE_MAPPED flag to allocate pte-mapped pages

From: Edgecombe, Rick P
Date: Tue Aug 24 2021 - 13:31:43 EST


On Tue, 2021-08-24 at 19:54 +0300, Mike Rapoport wrote:
> On Tue, Aug 24, 2021 at 04:38:03PM +0000, Edgecombe, Rick P wrote:
> > On Tue, 2021-08-24 at 16:02 +0300, Mike Rapoport wrote:
> > > > We probably want to exclude GFP_ATOMIC before calling into CPA
> > > > unless
> > > > debug page alloc is on, because it may need to split and sleep
> > > > for
> > > > the
> > > > allocation. There is a page table allocation with GFP_ATOMIC
> > > > passed
> > > > actually.
> > >
> > > Looking at the callers of alloc_low_pages() it seems that
> > > GFP_ATOMIC
> > > there
> > > is stale...
> >
> > Well two actually, there is also spp_getpage(). I tried to
> > determine if
> > that was also stale but wasn't confident. There were a lot of paths
> > in.
>
>
> It's also used at init and during memory hotplug, so I really doubt
> it
> needs GFP_ATOMIC.

Pretty sure it gets called after init by at least something besides
hotplug. I saw it during debugging with a little sanitizer I built to
find any unprotected page tables missed. Something tweaking the fixmap
IIRC. Did you look at the set_fixmap_() and set_pte_vaddr() family of
functions? Now whether any of them actually need GFP_ATOMIC, I am less
sure. There were a fair amount of drivers to analyze.