]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm: discard __GFP_ATOMIC
authorNeilBrown <neilb@suse.de>
Wed, 17 Aug 2022 20:58:22 +0000 (13:58 -0700)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 17 Aug 2022 20:58:22 +0000 (13:58 -0700)
commit00edb81bb6a69df184d84cda47d2bd0222855ac1
treef6481e21fe329ecba4ec3534c001478a98cf913f
parent71443ad8d6944bc3100ec3ee7b677a3eba992d9e
mm: discard __GFP_ATOMIC

__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
 - causes __GFP_HIGH to set ALLOC_HARDER unless __GFP_NOMEMALLOC is set
   (as well as ALLOC_HIGH).
 - 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.

Link: https://lkml.kernel.org/r/163712397076.13692.4727608274002939094@noble.neil.brown.name
Signed-off-by: NeilBrown <neilb@suse.de>
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Documentation/mm/balance.rst
drivers/iommu/tegra-smmu.c
include/linux/gfp_types.h
include/trace/events/mmflags.h
lib/test_printf.c
mm/internal.h
mm/page_alloc.c
tools/include/linux/gfp.h
tools/perf/builtin-kmem.c