From: Michal Hocko <mhocko@suse.com>
To: NeilBrown <neilb@suse.de>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Thierry Reding <thierry.reding@gmail.com>,
Matthew Wilcox <willy@infradead.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Mel Gorman <mgorman@suse.de>, Vlastimil Babka <vbabka@suse.cz>
Subject: Re: [PATCH] MM: discard __GFP_ATOMIC
Date: Mon, 22 Nov 2021 17:43:33 +0100 [thread overview]
Message-ID: <YZvItUOgTgD11etC@dhcp22.suse.cz> (raw)
In-Reply-To: <163712397076.13692.4727608274002939094@noble.neil.brown.name>
On Wed 17-11-21 15:39:30, Neil Brown wrote:
>
> __GFP_ATOMIC serves little purpose.
> It's main effect is to set ALLOC_HARDER which adds a few little boosts to
> increase the chance of an allocation succeeding, one of which is to
> lower the water-mark at which it will succeed.
>
> It is *always* paired with __GFP_HIGH which sets ALLOC_HIGH which also
> adjusts this watermark. It is probable that other users of __GFP_HIGH
> should benefit from the other little bonuses that __GFP_ATOMIC gets.
While I like to see __GFP_ATOMIC going away I am not really sure about
this particular part. We have 3 ways to get to memory reserves. One of
thme is directly controlable by __GFP_HIGH and two are internal to the
allocator to handle different situations - ALLOC_OOM is to help the oom
victim to make a fwd progress and ALLOC_HARDER should be for contexts
which cannot rely on the memory reclaim to continue.
What is the point of having ALLOC_HIGH and ALLOC_HARDER if you just
add both of them for __GFP_HIGH? I think you should be instead really
get back to pre d0164adc89f6b and allow ALLOC_HARDER for requests which
have neither of the reclaim allowed. That would require tweaking
GFP_ATOMIC as well I suspect and drop __GFP_KSWAPD_RECLAIM. Or do
something else.
> __GFP_ATOMIC also gives a warning if used with __GFP_DIRECT_RECLAIM.
> There is little point to this. We already get a might_sleep() warning
> if __GFP_DIRECT_RECLAIM is set.
I believe the point of the warning was to stop any abuse of an
additional memory reserves for context which can reclaim and to spare
those to interrupt handlers - which usually use GFP_ATOMIC. A lack of
any reports suggests this hasn't happened and the warning can be
dropped. Would be worth a patch on its own with this explanation.
> __GFP_ATOMIC allows the "watermark_boost" to be side-stepped. It is
> probable that testing ALLOC_HARDER is a better fit here.
This has been introduced by f80b08fc44536 but I have to say that I
haven't understood why this couldn't check for __GFP_DIRECT_RECLAIM
or one ALLOC_$FOO boosters rather than __GFP_ATOMIC. Again something for
a separate patch.
> __GFP_ATOMIC is used by tegra-smmu.c to check if the allocation might
> sleep. This should test __GFP_DIRECT_RECLAIM instead.
Willy has already proposed a better alternative.
Thanks!
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2021-11-22 16:44 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-17 4:39 NeilBrown
2021-11-17 13:18 ` Matthew Wilcox
2021-11-18 23:14 ` NeilBrown
2021-11-19 14:10 ` Matthew Wilcox
2021-11-20 10:51 ` NeilBrown
2021-11-22 16:54 ` Michal Hocko
2021-11-23 4:15 ` NeilBrown
2021-11-23 14:27 ` Michal Hocko
2021-11-18 9:22 ` Michal Hocko
2021-11-18 13:27 ` Mel Gorman
2021-11-18 23:02 ` NeilBrown
2021-11-22 16:43 ` Michal Hocko [this message]
2021-11-23 4:33 ` NeilBrown
2021-11-23 13:41 ` Michal Hocko
2022-04-30 18:30 ` Andrew Morton
2022-05-01 15:45 ` Michal Hocko
2022-09-06 7:35 ` Michal Hocko
2022-09-07 9:47 ` Mel Gorman
2022-10-17 2:38 ` Andrew Morton
2022-10-18 12:11 ` Mel Gorman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YZvItUOgTgD11etC@dhcp22.suse.cz \
--to=mhocko@suse.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=neilb@suse.de \
--cc=thierry.reding@gmail.com \
--cc=vbabka@suse.cz \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox