)]}'
{
  "commit": "9d8cebd4bcd7c3878462fdfda34bbcdeb4df7ef4",
  "tree": "0f0a6dadb4430aef18f1491003d70d9351d7b619",
  "parents": [
    "93e4a89a8c987189b168a530a331ef6d0fcf07a7"
  ],
  "author": {
    "name": "KOSAKI Motohiro",
    "email": "kosaki.motohiro@jp.fujitsu.com",
    "time": "Fri Mar 05 13:41:57 2010 -0800"
  },
  "committer": {
    "name": "Linus Torvalds",
    "email": "torvalds@linux-foundation.org",
    "time": "Sat Mar 06 11:26:25 2010 -0800"
  },
  "message": "mm: fix mbind vma merge problem\n\nStrangely, current mbind() doesn\u0027t merge vma with neighbor vma although it\u0027s possible.\nUnfortunately, many vma can reduce performance...\n\nThis patch fixes it.\n\n    reproduced program\n    ----------------------------------------------------------------\n     #include \u003cnumaif.h\u003e\n     #include \u003cnuma.h\u003e\n     #include \u003csys/mman.h\u003e\n     #include \u003cstdio.h\u003e\n     #include \u003cunistd.h\u003e\n     #include \u003cstdlib.h\u003e\n     #include \u003cstring.h\u003e\n\n    static unsigned long pagesize;\n\n    int main(int argc, char** argv)\n    {\n    \tvoid* addr;\n    \tint ch;\n    \tint node;\n    \tstruct bitmask *nmask \u003d numa_allocate_nodemask();\n    \tint err;\n    \tint node_set \u003d 0;\n    \tchar buf[128];\n\n    \twhile ((ch \u003d getopt(argc, argv, \"n:\")) !\u003d -1){\n    \t\tswitch (ch){\n    \t\tcase \u0027n\u0027:\n    \t\t\tnode \u003d strtol(optarg, NULL, 0);\n    \t\t\tnuma_bitmask_setbit(nmask, node);\n    \t\t\tnode_set \u003d 1;\n    \t\t\tbreak;\n    \t\tdefault:\n    \t\t\t;\n    \t\t}\n    \t}\n    \targc -\u003d optind;\n    \targv +\u003d optind;\n\n    \tif (!node_set)\n    \t\tnuma_bitmask_setbit(nmask, 0);\n\n    \tpagesize \u003d getpagesize();\n\n    \taddr \u003d mmap(NULL, pagesize*3, PROT_READ|PROT_WRITE,\n    \t\t    MAP_ANON|MAP_PRIVATE, 0, 0);\n    \tif (addr \u003d\u003d MAP_FAILED)\n    \t\tperror(\"mmap \"), exit(1);\n\n    \tfprintf(stderr, \"pid \u003d %d \\n\" \"addr \u003d %p\\n\", getpid(), addr);\n\n    \t/* make page populate */\n    \tmemset(addr, 0, pagesize*3);\n\n    \t/* first mbind */\n    \terr \u003d mbind(addr+pagesize, pagesize, MPOL_BIND, nmask-\u003emaskp,\n    \t\t    nmask-\u003esize, MPOL_MF_MOVE_ALL);\n    \tif (err)\n    \t\terror(\"mbind1 \");\n\n    \t/* second mbind */\n    \terr \u003d mbind(addr, pagesize*3, MPOL_DEFAULT, NULL, 0, 0);\n    \tif (err)\n    \t\terror(\"mbind2 \");\n\n    \tsprintf(buf, \"cat /proc/%d/maps\", getpid());\n    \tsystem(buf);\n\n    \treturn 0;\n    }\n    ----------------------------------------------------------------\n\nresult without this patch\n\n\taddr \u003d 0x7fe26ef09000\n\t[snip]\n\t7fe26ef09000-7fe26ef0a000 rw-p 00000000 00:00 0\n\t7fe26ef0a000-7fe26ef0b000 rw-p 00000000 00:00 0\n\t7fe26ef0b000-7fe26ef0c000 rw-p 00000000 00:00 0\n\t7fe26ef0c000-7fe26ef0d000 rw-p 00000000 00:00 0\n\n\t\u003d\u003e 0x7fe26ef09000-0x7fe26ef0c000 have three vmas.\n\nresult with this patch\n\n\taddr \u003d 0x7fc9ebc76000\n\t[snip]\n\t7fc9ebc76000-7fc9ebc7a000 rw-p 00000000 00:00 0\n\t7fffbe690000-7fffbe6a5000 rw-p 00000000\t00:00 0\t[stack]\n\n\t\u003d\u003e 0x7fc9ebc76000-0x7fc9ebc7a000 have only one vma.\n\n[minchan.kim@gmail.com: fix file offset passed to vma_merge()]\nSigned-off-by: KOSAKI Motohiro \u003ckosaki.motohiro@jp.fujitsu.com\u003e\nReviewed-by: Christoph Lameter \u003ccl@linux-foundation.org\u003e\nCc: Nick Piggin \u003cnickpiggin@yahoo.com.au\u003e\nCc: Hugh Dickins \u003chugh.dickins@tiscali.co.uk\u003e\nCc: Andrea Arcangeli \u003caarcange@redhat.com\u003e\nCc: Mel Gorman \u003cmel@csn.ul.ie\u003e\nCc: Lee Schermerhorn \u003clee.schermerhorn@hp.com\u003e\nSigned-off-by: Minchan Kim \u003cminchan.kim@gmail.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": "290fb5bf0440f7a5e0f05f4adeffd3decb785d00",
      "old_mode": 33188,
      "old_path": "mm/mempolicy.c",
      "new_id": "44dd9d1521ec49faddfe14283a60d746ac171de7",
      "new_mode": 33188,
      "new_path": "mm/mempolicy.c"
    }
  ]
}
