)]}'
{
  "commit": "627240aaa92a4dc00d25584910b5f205e963747b",
  "tree": "7e05e87ecc48b57de8c2eeb872ce7a0102c2af3b",
  "parents": [
    "b635acec48bcaa9183fcbf4e3955616b0d4119b5"
  ],
  "author": {
    "name": "Mikulas Patocka",
    "email": "mpatocka@redhat.com",
    "time": "Fri Aug 15 00:40:17 2008 -0700"
  },
  "committer": {
    "name": "Linus Torvalds",
    "email": "torvalds@linux-foundation.org",
    "time": "Fri Aug 15 08:35:41 2008 -0700"
  },
  "message": "bootmem allocator: alloc_bootmem_core(): page-align the end offset\n\nThis is the minimal sequence that jams the allocator:\n\nvoid *p, *q, *r;\np \u003d alloc_bootmem(PAGE_SIZE);\nq \u003d alloc_bootmem(64);\nfree_bootmem(p, PAGE_SIZE);\np \u003d alloc_bootmem(PAGE_SIZE);\nr \u003d alloc_bootmem(64);\n\nafter this sequence (assuming that the allocator was empty or page-aligned\nbefore), pointer \"q\" will be equal to pointer \"r\".\n\nWhat\u0027s hapenning inside the allocator:\np \u003d alloc_bootmem(PAGE_SIZE);\nin allocator: last_end_off \u003d\u003d PAGE_SIZE, bitmap contains bits 10000...\nq \u003d alloc_bootmem(64);\nin allocator: last_end_off \u003d\u003d PAGE_SIZE + 64, bitmap contains 11000...\nfree_bootmem(p, PAGE_SIZE);\nin allocator: last_end_off \u003d\u003d PAGE_SIZE + 64, bitmap contains 01000...\np \u003d alloc_bootmem(PAGE_SIZE);\nin allocator: last_end_off \u003d\u003d PAGE_SIZE, bitmap contains 11000...\nr \u003d alloc_bootmem(64);\n\nand now:\n\nit finds bit \"2\", as a place where to allocate (sidx)\n\nit hits the condition\n\nif (bdata-\u003elast_end_off \u0026\u0026 PFN_DOWN(bdata-\u003elast_end_off) + 1 \u003d\u003d sidx))\nstart_off \u003d ALIGN(bdata-\u003elast_end_off, align);\n\n-you can see that the condition is true, so it assigns start_off \u003d\nALIGN(bdata-\u003elast_end_off, align); (that is PAGE_SIZE) and allocates\nover already allocated block.\n\nWith the patch it tries to continue at the end of previous allocation only\nif the previous allocation ended in the middle of the page.\n\nSigned-off-by: Mikulas Patocka \u003cmpatocka@redhat.com\u003e\nAcked-by: Johannes Weiner \u003channes@saeurebad.de\u003e\nCc: David Miller \u003cdavem@davemloft.net\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": "4af15d0340adaa7bc9cded10d36302679d86f90a",
      "old_mode": 33188,
      "old_path": "mm/bootmem.c",
      "new_id": "e023c68b025555b6110e8d6352f9ad19e5c7f7f7",
      "new_mode": 33188,
      "new_path": "mm/bootmem.c"
    }
  ]
}
