)]}'
{
  "commit": "348ea204cc23cda35faf962414b674c57da647d7",
  "tree": "fb27a17c13ca745bd3f0fb15d0d967bc5d5bc088",
  "parents": [
    "6c55be8b962f1bdc592d579e81fc27b11ea53dfc"
  ],
  "author": {
    "name": "Adam Litke",
    "email": "agl@us.ibm.com",
    "time": "Wed Nov 14 16:59:37 2007 -0800"
  },
  "committer": {
    "name": "Linus Torvalds",
    "email": "torvalds@woody.linux-foundation.org",
    "time": "Wed Nov 14 18:45:39 2007 -0800"
  },
  "message": "hugetlb: split alloc_huge_page into private and shared components\n\nHugetlbfs implements a quota system which can limit the amount of memory that\ncan be used by the filesystem.  Before allocating a new huge page for a file,\nthe quota is checked and debited.  The quota is then credited when truncating\nthe file.  I found a few bugs in the code for both MAP_PRIVATE and MAP_SHARED\nmappings.  Before detailing the problems and my proposed solutions, we should\nagree on a definition of quotas that properly addresses both private and\nshared pages.  Since the purpose of quotas is to limit total memory\nconsumption on a per-filesystem basis, I argue that all pages allocated by the\nfs (private and shared) should be charged against quota.\n\nPrivate Mappings\n\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\n\nThe current code will debit quota for private pages sometimes, but will never\ncredit it.  At a minimum, this causes a leak in the quota accounting which\nrenders the accounting essentially useless as it is.  Shared pages have a one\nto one mapping with a hugetlbfs file and are easy to account by debiting on\nallocation and crediting on truncate.  Private pages are anonymous in nature\nand have a many to one relationship with their hugetlbfs files (due to copy on\nwrite).  Because private pages are not indexed by the mapping\u0027s radix tree,\nthier quota cannot be credited at file truncation time.  Crediting must be\ndone when the page is unmapped and freed.\n\nShared Pages\n\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\n\nI discovered an issue concerning the interaction between the MAP_SHARED\nreservation system and quotas.  Since quota is not checked until page\ninstantiation, an over-quota mmap/reservation will initially succeed.  When\ninstantiating the first over-quota page, the program will receive SIGBUS.\nThis is inconsistent since the reservation is supposed to be a guarantee.  The\nsolution is to debit the full amount of quota at reservation time and credit\nthe unused portion when the reservation is released.\n\nThis patch series brings quotas back in line by making the following\nmodifications:\n * Private pages\n   - Debit quota in alloc_huge_page()\n   - Credit quota in free_huge_page()\n * Shared pages\n   - Debit quota for entire reservation at mmap time\n   - Credit quota for instantiated pages in free_huge_page()\n   - Credit quota for unused reservation at munmap time\n\nThis patch:\n\nThe shared page reservation and dynamic pool resizing features have made the\nallocation of private vs.  shared huge pages quite different.  By splitting\nout the private/shared-specific portions of the process into their own\nfunctions, readability is greatly improved.  alloc_huge_page now calls the\nproper helper and performs common operations.\n\n[akpm@linux-foundation.org: coding-style cleanups]\nSigned-off-by: Adam Litke \u003cagl@us.ibm.com\u003e\nCc: Ken Chen \u003ckenchen@google.com\u003e\nCc: Andy Whitcroft \u003capw@shadowen.org\u003e\nCc: Dave Hansen \u003chaveblue@us.ibm.com\u003e\nCc: David Gibson \u003chermes@gibson.dropbear.id.au\u003e\nCc: William Lee Irwin III \u003cwli@holomorphy.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": "e2c80631d36a29c5c9f93454c6cddebd5d218265",
      "old_mode": 33188,
      "old_path": "mm/hugetlb.c",
      "new_id": "f43b3dca12b5e65eabef79e8bf7f97b11c25115c",
      "new_mode": 33188,
      "new_path": "mm/hugetlb.c"
    }
  ]
}
