)]}'
{
  "commit": "cb79295e20a8088a2fd6a9b3cb5f2d889ec36b4d",
  "tree": "e749be4ebd059d9dd1ff109c1cecb7b63109d2e0",
  "parents": [
    "f7505d64f2db5da2d7d94873ddf2cd2524847061"
  ],
  "author": {
    "name": "Anton Vorontsov",
    "email": "anton.vorontsov@linaro.org",
    "time": "Thu May 31 16:26:22 2012 -0700"
  },
  "committer": {
    "name": "Linus Torvalds",
    "email": "torvalds@linux-foundation.org",
    "time": "Thu May 31 17:49:29 2012 -0700"
  },
  "message": "cpu: introduce clear_tasks_mm_cpumask() helper\n\nMany architectures clear tasks\u0027 mm_cpumask like this:\n\n\tread_lock(\u0026tasklist_lock);\n\tfor_each_process(p) {\n\t\tif (p-\u003emm)\n\t\t\tcpumask_clear_cpu(cpu, mm_cpumask(p-\u003emm));\n\t}\n\tread_unlock(\u0026tasklist_lock);\n\nDepending on the context, the code above may have several problems,\nsuch as:\n\n1. Working with task-\u003emm w/o getting mm or grabing the task lock is\n   dangerous as -\u003emm might disappear (exit_mm() assigns NULL under\n   task_lock(), so tasklist lock is not enough).\n\n2. Checking for process-\u003emm is not enough because process\u0027 main\n   thread may exit or detach its mm via use_mm(), but other threads\n   may still have a valid mm.\n\nThis patch implements a small helper function that does things\ncorrectly, i.e.:\n\n1. We take the task\u0027s lock while whe handle its mm (we can\u0027t use\n   get_task_mm()/mmput() pair as mmput() might sleep);\n\n2. To catch exited main thread case, we use find_lock_task_mm(),\n   which walks up all threads and returns an appropriate task\n   (with task lock held).\n\nAlso, Per Peter Zijlstra\u0027s idea, now we don\u0027t grab tasklist_lock in\nthe new helper, instead we take the rcu read lock. We can do this\nbecause the function is called after the cpu is taken down and marked\noffline, so no new tasks will get this cpu set in their mm mask.\n\nSigned-off-by: Anton Vorontsov \u003canton.vorontsov@linaro.org\u003e\nCc: Richard Weinberger \u003crichard@nod.at\u003e\nCc: Oleg Nesterov \u003coleg@redhat.com\u003e\nCc: Peter Zijlstra \u003ca.p.zijlstra@chello.nl\u003e\nCc: Russell King \u003crmk@arm.linux.org.uk\u003e\nCc: Benjamin Herrenschmidt \u003cbenh@kernel.crashing.org\u003e\nCc: Mike Frysinger \u003cvapier@gentoo.org\u003e\nCc: Paul Mundt \u003clethal@linux-sh.org\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": "7230bb59a06fec1f09ec379027729ee472193c07",
      "old_mode": 33188,
      "old_path": "include/linux/cpu.h",
      "new_id": "2e9b9ebbeb78927681026ddbceb0255bc9197aad",
      "new_mode": 33188,
      "new_path": "include/linux/cpu.h"
    },
    {
      "type": "modify",
      "old_id": "0e6353cf147abf51c4f760054971915063ece928",
      "old_mode": 33188,
      "old_path": "kernel/cpu.c",
      "new_id": "0575197deb4ac46e650b8931aa9e20fe9901ce18",
      "new_mode": 33188,
      "new_path": "kernel/cpu.c"
    }
  ]
}
