Skip to content
  • David Rientjes's avatar
    mm: remove GFP_THISNODE · 4167e9b2
    David Rientjes authored
    NOTE: this is not about __GFP_THISNODE, this is only about GFP_THISNODE.
    GFP_THISNODE is a secret combination of gfp bits that have different
    behavior than expected.  It is a combination of __GFP_THISNODE,
    __GFP_NORETRY, and __GFP_NOWARN and is special-cased in the page
    allocator slowpath to fail without trying reclaim even though it may be
    used in combination with __GFP_WAIT.
    An example of the problem this creates: commit e97ca8e5
     ("mm: fix
    GFP_THISNODE callers and clarify") fixed up many users of GFP_THISNODE
    that really just wanted __GFP_THISNODE.  The problem doesn't end there,
    however, because even it was a no-op for alloc_misplaced_dst_page(),
    which also sets __GFP_NORETRY and __GFP_NOWARN, and
    migrate_misplaced_transhuge_page(), where __GFP_NORETRY and __GFP_NOWAIT
    is set in GFP_TRANSHUGE.  Converting GFP_THISNODE to __GFP_THISNODE is a
    no-op in these cases since the page allocator special-cases
    It's time to just remove GFP_THISNODE entirely.  We leave __GFP_THISNODE
    to restrict an allocation to a local node, but remove GFP_THISNODE and
    its obscurity.  Instead, we require that a caller clear __GFP_WAIT if it
    wants to avoid reclaim.
    This allows the aforementioned functions to actually reclaim as they
    should.  It also enables any future callers that want to do
    __GFP_THISNODE but also __GFP_NORETRY && __GFP_NOWARN to reclaim.  The
    rule is simple: if you don't want to reclaim, then don't set __GFP_WAIT.
    Aside: ovs_flow_stats_update() really wants to avoid reclaim as well, so
    it is unchanged.
    Signed-off-by: default avatarDavid Rientjes <>
    Acked-by: default avatarVlastimil Babka <>
    Cc: Christoph Lameter <>
    Acked-by: default avatarPekka Enberg <>
    Cc: Joonsoo Kim <>
    Acked-by: default avatarJohannes Weiner <>
    Cc: Mel Gorman <>
    Cc: Pravin Shelar <>
    Cc: Jarno Rajahalme <>
    Cc: Li Zefan <>
    Cc: Greg Thelen <>
    Cc: Tejun Heo <>
    Signed-off-by: default avatarAndrew Morton <>
    Signed-off-by: default avatarLinus Torvalds <>