)]}'
{
  "commit": "0c270f8f9988fb0d93ea214fdcff7ab90eb3d894",
  "tree": "b4f77a6714d245841ecec535ccbeba535c0d29a4",
  "parents": [
    "45531757b45cae0ce64c5aff08c2534d5a0fa3e7"
  ],
  "author": {
    "name": "KAMEZAWA Hiroyuki",
    "email": "kamezawa.hiroyu@jp.fujitsu.com",
    "time": "Wed Oct 27 15:33:39 2010 -0700"
  },
  "committer": {
    "name": "Linus Torvalds",
    "email": "torvalds@linux-foundation.org",
    "time": "Wed Oct 27 18:03:09 2010 -0700"
  },
  "message": "memcg: fix race in file_mapped accouting flag management\n\nPresently memory cgroup accounts file-mapped by counter and flag.  counter\nis working in the same way with zone_stat but FileMapped flag only exists\nin memcg (for helping move_account).\n\nThis flag can be updated wrongly in a case.  Assume CPU0 and CPU1 and a\nthread mapping a page on CPU0, another thread unmapping it on CPU1.\n\n    CPU0                   \t\tCPU1\n\t\t\t\trmv rmap (mapcount 1-\u003e0)\n   add rmap (mapcount 0-\u003e1)\n   lock_page_cgroup()\n   memcg counter+1\t\t(some delay)\n   set MAPPED FLAG.\n   unlock_page_cgroup()\n\t\t\t\tlock_page_cgroup()\n\t\t\t\tmemcg counter-1\n\t\t\t\tclear MAPPED flag\n\nIn the above sequence counter is properly updated but FLAG is not.  This\nmeans that representing a state by a flag which is maintained by counter\nneeds some special care.\n\nTo handle this, when clearing a flag, this patch check mapcount directly\nand clear the flag only when mapcount \u003d\u003d 0.  (if mapcount \u003e0, someone will\nmake it to zero later and flag will be cleared.)\n\nReverse case, dec-after-inc cannot be a problem because page_table_lock()\nworks well for it.  (IOW, to make above sequence, 2 processes should touch\nthe same page at once with map/unmap.)\n\nSigned-off-by: KAMEZAWA Hiroyuki \u003ckamezawa.hiroyu@jp.fujitsu.com\u003e\nCc: Balbir Singh \u003cbalbir@in.ibm.com\u003e\nCc: Daisuke Nishimura \u003cnishimura@mxp.nes.nec.co.jp\u003e\nCc: Greg Thelen \u003cgthelen@google.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": "9be3cf8a5da462d4b1b4103eef61f8d5a9a6e06c",
      "old_mode": 33188,
      "old_path": "mm/memcontrol.c",
      "new_id": "0e3fdbd809c7dad28cc5c6558ad9d2ab23bf982f",
      "new_mode": 33188,
      "new_path": "mm/memcontrol.c"
    }
  ]
}
