linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mel Gorman <mgorman@techsingularity.net>
To: Mike Rapoport <rppt@kernel.org>
Cc: Linux-MM <linux-mm@kvack.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Michal Hocko <mhocko@suse.com>, NeilBrown <neilb@suse.de>,
	Thierry Reding <thierry.reding@gmail.com>,
	Matthew Wilcox <willy@infradead.org>,
	Vlastimil Babka <vbabka@suse.cz>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 6/6] mm: discard __GFP_ATOMIC
Date: Fri, 6 Jan 2023 09:35:24 +0000	[thread overview]
Message-ID: <20230106093524.ck5otyaopd724een@techsingularity.net> (raw)
In-Reply-To: <Y7bVeE1gtSmS25td@kernel.org>

On Thu, Jan 05, 2023 at 03:49:44PM +0200, Mike Rapoport wrote:
> Hi Mel,
> 
> On Tue, Nov 29, 2022 at 03:17:01PM +0000, Mel Gorman wrote:
> > From: NeilBrown <neilb@suse.de>
> > 
> > __GFP_ATOMIC serves little purpose.  Its 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.
> > 
> > __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.
> > 
> > __GFP_ATOMIC allows the "watermark_boost" to be side-stepped.  It is
> > probable that testing ALLOC_HARDER is a better fit here.
> > 
> > __GFP_ATOMIC is used by tegra-smmu.c to check if the allocation might
> > sleep.  This should test __GFP_DIRECT_RECLAIM instead.
> > 
> > This patch:
> >  - removes __GFP_ATOMIC
> >  - allows __GFP_HIGH allocations to ignore watermark boosting as well
> >    as GFP_ATOMIC requests.
> >  - makes other adjustments as suggested by the above.
> > 
> > The net result is not change to GFP_ATOMIC allocations.  Other
> > allocations that use __GFP_HIGH will benefit from a few different extra
> > privileges.  This affects:
> >   xen, dm, md, ntfs3
> >   the vermillion frame buffer
> >   hibernation
> >   ksm
> >   swap
> > all of which likely produce more benefit than cost if these selected
> > allocation are more likely to succeed quickly.
> > 
> > [mgorman: Minor adjustments to rework on top of a series]
> > Link: https://lkml.kernel.org/r/163712397076.13692.4727608274002939094@noble.neil.brown.name
> > Signed-off-by: NeilBrown <neilb@suse.de>
> > Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
> > ---
> >  Documentation/mm/balance.rst   |  2 +-
> 
> Documentation/core-api/memory-allocation.rst needs an update as well, and
> there are other mentions of GFP_ATOMIC in Documentation/
> 

What part do you think needs updating in that file?

There are two references to GFP_ATOMIC in that file, one about accessing
reserves and another about non-sleeping allocations and the accuracy
does not change after the series. If anything, this statement should
change because it invites GFP_ATOMIC abuse for spurious reasons

  * If you think that accessing memory reserves is justified and the kernel
    will be stressed unless allocation succeeds, you may use ``GFP_ATOMIC``.

There are other references to GFP_ATOMIC in Documentation/ that are are a
little inaccurate but not in a way that is harmful and is not changed by
the series. For example;

	GFP_ATOMIC requests are kernel internal allocations that must
	be satisfied, immediately.  The kernel may drop some request,
	in rare cases even panic, if a GFP_ATOMIC alloc fails.

This is a stronger statement than GFP_ATOMIC deserves but it's close enough
in the given context.

-- 
Mel Gorman
SUSE Labs

  parent reply	other threads:[~2023-01-06  9:41 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-29 15:16 [RFC PATCH 0/6] Discard __GFP_ATOMIC Mel Gorman
2022-11-29 15:16 ` [PATCH 1/6] mm/page_alloc: Rename ALLOC_HIGH to ALLOC_MIN_RESERVE Mel Gorman
2022-12-08 16:12   ` Vlastimil Babka
2022-11-29 15:16 ` [PATCH 2/6] mm/page_alloc: Treat RT tasks similar to GFP_HIGH Mel Gorman
2022-12-08 16:16   ` Vlastimil Babka
2022-11-29 15:16 ` [PATCH 3/6] mm/page_alloc: Explicitly record high-order atomic allocations in alloc_flags Mel Gorman
2022-12-05  5:17   ` NeilBrown
2022-12-05 10:27     ` Mel Gorman
2022-12-08 16:51   ` Vlastimil Babka
2023-01-04 11:45     ` Mel Gorman
2022-11-29 15:16 ` [PATCH 4/6] mm/page_alloc: Explicitly define what alloc flags deplete min reserves Mel Gorman
2022-12-08 17:55   ` Vlastimil Babka
2023-01-04 12:02     ` Mel Gorman
2022-11-29 15:17 ` [PATCH 5/6] mm/page_alloc: Give GFP_ATOMIC and non-blocking allocations access to reserves Mel Gorman
2022-12-08 18:07   ` Vlastimil Babka
2023-01-04 12:03     ` Mel Gorman
2022-11-29 15:17 ` [PATCH 6/6] mm: discard __GFP_ATOMIC Mel Gorman
2022-12-08 18:17   ` Vlastimil Babka
2023-01-04 12:04     ` Mel Gorman
2023-01-05 13:49   ` Mike Rapoport
2023-01-05 21:53     ` NeilBrown
2023-01-06  9:35     ` Mel Gorman [this message]
2023-01-08  9:30       ` Mike Rapoport
2023-01-13 11:12 [PATCH 0/6 v3] Discard __GFP_ATOMIC Mel Gorman
2023-01-13 11:12 ` [PATCH 6/6] mm: discard __GFP_ATOMIC 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=20230106093524.ck5otyaopd724een@techsingularity.net \
    --to=mgorman@techsingularity.net \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=neilb@suse.de \
    --cc=rppt@kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).