)]}'
{
  "commit": "a74327703827cb7b4b43f4a409f6a90ea7c0552a",
  "tree": "3d3c89175c7a77de8a4412dac8c1f670de55baa5",
  "parents": [
    "a636881daf80f2849b0a588a13a57aa0b8132122"
  ],
  "author": {
    "name": "Vlastimil Babka",
    "email": "vbabka@suse.cz",
    "time": "Thu Jun 07 17:09:29 2018 -0700"
  },
  "committer": {
    "name": "Greg Kroah-Hartman",
    "email": "gregkh@linuxfoundation.org",
    "time": "Tue Jun 26 07:54:07 2018 +0800"
  },
  "message": "mm, page_alloc: do not break __GFP_THISNODE by zonelist reset\n\ncommit 7810e6781e0fcbca78b91cf65053f895bf59e85f upstream.\n\nIn __alloc_pages_slowpath() we reset zonelist and preferred_zoneref for\nallocations that can ignore memory policies.  The zonelist is obtained\nfrom current CPU\u0027s node.  This is a problem for __GFP_THISNODE\nallocations that want to allocate on a different node, e.g.  because the\nallocating thread has been migrated to a different CPU.\n\nThis has been observed to break SLAB in our 4.4-based kernel, because\nthere it relies on __GFP_THISNODE working as intended.  If a slab page\nis put on wrong node\u0027s list, then further list manipulations may corrupt\nthe list because page_to_nid() is used to determine which node\u0027s\nlist_lock should be locked and thus we may take a wrong lock and race.\n\nCurrent SLAB implementation seems to be immune by luck thanks to commit\n511e3a058812 (\"mm/slab: make cache_grow() handle the page allocated on\narbitrary node\") but there may be others assuming that __GFP_THISNODE\nworks as promised.\n\nWe can fix it by simply removing the zonelist reset completely.  There\nis actually no reason to reset it, because memory policies and cpusets\ndon\u0027t affect the zonelist choice in the first place.  This was different\nwhen commit 183f6371aac2 (\"mm: ignore mempolicies when using\nALLOC_NO_WATERMARK\") introduced the code, as mempolicies provided their\nown restricted zonelists.\n\nWe might consider this for 4.17 although I don\u0027t know if there\u0027s\nanything currently broken.\n\nSLAB is currently not affected, but in kernels older than 4.7 that don\u0027t\nyet have 511e3a058812 (\"mm/slab: make cache_grow() handle the page\nallocated on arbitrary node\") it is.  That\u0027s at least 4.4 LTS.  Older\nones I\u0027ll have to check.\n\nSo stable backports should be more important, but will have to be\nreviewed carefully, as the code went through many changes.  BTW I think\nthat also the ac-\u003epreferred_zoneref reset is currently useless if we\ndon\u0027t also reset ac-\u003enodemask from a mempolicy to NULL first (which we\nprobably should for the OOM victims etc?), but I would leave that for a\nseparate patch.\n\nLink: http://lkml.kernel.org/r/20180525130853.13915-1-vbabka@suse.cz\nSigned-off-by: Vlastimil Babka \u003cvbabka@suse.cz\u003e\nFixes: 183f6371aac2 (\"mm: ignore mempolicies when using ALLOC_NO_WATERMARK\")\nAcked-by: Mel Gorman \u003cmgorman@techsingularity.net\u003e\nCc: Michal Hocko \u003cmhocko@kernel.org\u003e\nCc: David Rientjes \u003crientjes@google.com\u003e\nCc: Joonsoo Kim \u003ciamjoonsoo.kim@lge.com\u003e\nCc: Vlastimil Babka \u003cvbabka@suse.cz\u003e\nCc: \u003cstable@vger.kernel.org\u003e\nSigned-off-by: Andrew Morton \u003cakpm@linux-foundation.org\u003e\nSigned-off-by: Linus Torvalds \u003ctorvalds@linux-foundation.org\u003e\nSigned-off-by: Greg Kroah-Hartman \u003cgregkh@linuxfoundation.org\u003e\n\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "1741dd23e7c1f7d4878cf38ff9ba021928f99267",
      "old_mode": 33188,
      "old_path": "mm/page_alloc.c",
      "new_id": "bd68b6d1f8920631f726924da7a0044a0699b3bf",
      "new_mode": 33188,
      "new_path": "mm/page_alloc.c"
    }
  ]
}
