• NeilBrown's avatar
    mm: discard __GFP_ATOMIC · 2973d822
    NeilBrown authored
    __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
    Link: https://lkml.kernel.org/r/20230113111217.14134-7-mgorman@techsingularity.netSigned-off-by: default avatarNeilBrown <neilb@suse.de>
    Signed-off-by: default avatarMel Gorman <mgorman@techsingularity.net>
    Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
    Acked-by: default avatarMichal Hocko <mhocko@suse.com>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: Thierry Reding <thierry.reding@gmail.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    2973d822
internal.h 28.2 KB