Re: [PATCH 5/6] mm/page_alloc: Give GFP_ATOMIC and non-blocking allocations access to reserves

From: Mel Gorman
Date: Wed Jan 04 2023 - 07:04:31 EST


On Thu, Dec 08, 2022 at 07:07:06PM +0100, Vlastimil Babka wrote:
> On 11/29/22 16:17, Mel Gorman wrote:
> > @@ -4846,28 +4846,30 @@ gfp_to_alloc_flags(gfp_t gfp_mask, unsigned int order)
> > * The caller may dip into page reserves a bit more if the caller
> > * cannot run direct reclaim, or if the caller has realtime scheduling
> > * policy or is asking for __GFP_HIGH memory. GFP_ATOMIC requests will
> > - * set both ALLOC_HARDER (__GFP_ATOMIC) and ALLOC_MIN_RESERVE(__GFP_HIGH).
> > + * set both ALLOC_NON_BLOCK and ALLOC_MIN_RESERVE(__GFP_HIGH).
> > */
> > alloc_flags |= (__force int)
> > (gfp_mask & (__GFP_HIGH | __GFP_KSWAPD_RECLAIM));
> >
> > - if (gfp_mask & __GFP_ATOMIC) {
> > + if (!(gfp_mask & __GFP_RECLAIM)) {
>
> This is supposed to be __GFP_DIRECT_RECLAIM right? Otherwise that includes
> also __GFP_KSWAPD_RECLAIM and GFP_ATOMIC sets that one...
>

Yes

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 0b2093d17b48..2217bab2dbb2 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4856,7 +4856,7 @@ gfp_to_alloc_flags(gfp_t gfp_mask, unsigned int order)
alloc_flags |= (__force int)
(gfp_mask & (__GFP_HIGH | __GFP_KSWAPD_RECLAIM));

- if (!(gfp_mask & __GFP_RECLAIM)) {
+ if (!(gfp_mask & __GFP_DIRECT_RECLAIM)) {
/*
* Not worth trying to allocate harder for __GFP_NOMEMALLOC even
* if it can't schedule.

--
Mel Gorman
SUSE Labs