[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <163727727803.13692.15470049610672496362@noble.neil.brown.name>
Date: Fri, 19 Nov 2021 10:14:38 +1100
From: "NeilBrown" <neilb@...e.de>
To: "Matthew Wilcox" <willy@...radead.org>
Cc: "Andrew Morton" <akpm@...ux-foundation.org>,
"Michal Hocko" <mhocko@...e.com>,
"Thierry Reding" <thierry.reding@...il.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] MM: discard __GFP_ATOMIC
On Thu, 18 Nov 2021, Matthew Wilcox wrote:
> On Wed, Nov 17, 2021 at 03:39:30PM +1100, NeilBrown wrote:
> > +++ b/drivers/iommu/tegra-smmu.c
> > @@ -676,12 +676,12 @@ static struct page *as_get_pde_page(struct tegra_smmu_as *as,
> > * allocate page in a sleeping context if GFP flags permit. Hence
> > * spinlock needs to be unlocked and re-locked after allocation.
> > */
> > - if (!(gfp & __GFP_ATOMIC))
> > + if (gfp & __GFP_DIRECT_RECLAIM)
> > spin_unlock_irqrestore(&as->lock, *flags);
> >
> > page = alloc_page(gfp | __GFP_DMA | __GFP_ZERO);
> >
> > - if (!(gfp & __GFP_ATOMIC))
> > + if (gfp & __GFP_DIRECT_RECLAIM)
> > spin_lock_irqsave(&as->lock, *flags);
> >
> > /*
>
> Surely this should be gfpflags_allow_blocking() instead of poking about
> in the innards of gfp flags?
Possibly. Didn't know about gfpflags_allow_blocking(). From a quick
grep in the kernel, a whole lot of other people don't know about it
either, though clearly some do.
Maybe we should reaname "__GFP_DIRECT_RECLAIM" to
"__GFP_ALLOW_BLOCKING", because that is what most users seems to care
about.
If not, then we probably want a gfpflags_without_block() function that
removes that flag, as lots of code wants to do that - and using the flag
for one, and an inline for the other is not consistent.
My leaning would be to __GFP_ALLOW_BLOCKING
NeilBrown
>
> This patch seems like a good simplification to me.
>
> Reviewed-by: Matthew Wilcox (Oracle) <willy@...radead.org>
Thanks,
NeilBrown
Powered by blists - more mailing lists