)]}'
{
  "commit": "1dd308a7b49d4bdbc17bfa570675ecc8cf7bedb3",
  "tree": "01084f854cf648b9a37ea27e9a2147c41e600f3a",
  "parents": [
    "9b012a29a300ea780d919205906d00d15cc6286e"
  ],
  "author": {
    "name": "Mike Kravetz",
    "email": "mike.kravetz@oracle.com",
    "time": "Wed Jun 24 16:57:52 2015 -0700"
  },
  "committer": {
    "name": "Linus Torvalds",
    "email": "torvalds@linux-foundation.org",
    "time": "Wed Jun 24 17:49:44 2015 -0700"
  },
  "message": "mm/hugetlb: document the reserve map/region tracking routines\n\nWhile working on hugetlbfs fallocate support, I noticed the following race\nin the existing code.  It is unlikely that this race is hit very often in\nthe current code.  However, if more functionality to add and remove pages\nto hugetlbfs mappings (such as fallocate) is added the likelihood of\nhitting this race will increase.\n\nalloc_huge_page and hugetlb_reserve_pages use information from the reserve\nmap to determine if there are enough available huge pages to complete the\noperation, as well as adjust global reserve and subpool usage counts.  The\norder of operations is as follows:\n\n- call region_chg() to determine the expected change based on reserve map\n- determine if enough resources are available for this operation\n- adjust global counts based on the expected change\n- call region_add() to update the reserve map\n\nThe issue is that reserve map could change between the call to region_chg\nand region_add.  In this case, the counters which were adjusted based on\nthe output of region_chg will not be correct.\n\nIn order to hit this race today, there must be an existing shared hugetlb\nmmap created with the MAP_NORESERVE flag.  A page fault to allocate a huge\npage via this mapping must occur at the same another task is mapping the\nsame region without the MAP_NORESERVE flag.\n\nThe patch set does not prevent the race from happening.  Rather, it adds\nsimple functionality to detect when the race has occurred.  If a race is\ndetected, then the incorrect counts are adjusted.\n\nReview comments pointed out the need for documentation of the existing\nregion/reserve map routines.  This patch set also adds documentation in\nthis area.\n\nThis patch (of 3):\n\nThis is a documentation only patch and does not modify any code.\nDescriptions of the routines used for reserve map/region tracking are\nadded.\n\nSigned-off-by: Mike Kravetz \u003cmike.kravetz@oracle.com\u003e\nCc: Naoya Horiguchi \u003cn-horiguchi@ah.jp.nec.com\u003e\nCc: Davidlohr Bueso \u003cdave@stgolabs.net\u003e\nCc: David Rientjes \u003crientjes@google.com\u003e\nCc: Luiz Capitulino \u003clcapitulino@redhat.com\u003e\nSigned-off-by: Andrew Morton \u003cakpm@linux-foundation.org\u003e\nSigned-off-by: Linus Torvalds \u003ctorvalds@linux-foundation.org\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "10de25cf1f99ae33df5a9834a9f40a17e631f9a9",
      "old_mode": 33188,
      "old_path": "mm/hugetlb.c",
      "new_id": "4a1d7021efaf71871417f041b48a349ade27a9b0",
      "new_mode": 33188,
      "new_path": "mm/hugetlb.c"
    }
  ]
}
