)]}'
{
  "commit": "2b17c545a4cdbbbadcd7f1e9684c2d7db8f085a6",
  "tree": "a783e9c98438f0028ef4411a81eb0ca2a8387f55",
  "parents": [
    "b3eda8d05c1afe722dc19be3fee7eeadc75e25e2"
  ],
  "author": {
    "name": "Frederic Weisbecker",
    "email": "fweisbec@gmail.com",
    "time": "Thu Oct 04 01:46:44 2012 +0200"
  },
  "committer": {
    "name": "Ingo Molnar",
    "email": "mingo@kernel.org",
    "time": "Fri Oct 05 10:22:20 2012 +0200"
  },
  "message": "nohz: Fix one jiffy count too far in idle cputime\n\nWhen we stop the tick in idle, we save the current jiffies value\nin ts-\u003eidle_jiffies. This snapshot is substracted from the later\nvalue of jiffies when the tick is restarted and the resulting\ndelta is accounted as idle cputime. This is how we handle the\nidle cputime accounting without the tick.\n\nBut sometimes we need to schedule the next tick to some time in\nthe future instead of completely stopping it. In this case, a\ntick may happen before we restart the periodic behaviour and\nfrom that tick we account one jiffy to idle cputime as usual but\nwe also increment the ts-\u003eidle_jiffies snapshot by one so that\nwhen we compute the delta to account, we substract the one jiffy\nwe just accounted.\n\nTo prepare for stopping the tick outside idle, we introduced a\ncheck that prevents from fixing up that ts-\u003eidle_jiffies if we\nare not running the idle task. But we use idle_cpu() for that\nand this is a problem if we run the tick while another CPU\nremotely enqueues a ttwu to our runqueue:\n\nCPU 0:                            CPU 1:\n\ntick_sched_timer() {              ttwu_queue_remote()\n       if (idle_cpu(CPU 0))\n           ts-\u003eidle_jiffies++;\n}\n\nHere, idle_cpu() notes that \u0026rq-\u003ewake_list is not empty and\nhence won\u0027t consider the CPU as idle. As a result,\nts-\u003eidle_jiffies won\u0027t be incremented. But this is wrong because\nwe actually account the current jiffy to idle cputime. And that\njiffy won\u0027t get substracted from the nohz time delta. So in the\nend, this jiffy is accounted twice.\n\nFix this by changing idle_cpu(smp_processor_id()) with\nis_idle_task(current). This way the jiffy is substracted\ncorrectly even if a ttwu operation is enqueued on the CPU.\n\nSigned-off-by: Frederic Weisbecker \u003cfweisbec@gmail.com\u003e\nCc: Peter Zijlstra \u003cpeterz@infradead.org\u003e\nCc: \u003cstable@vger.kernel.org\u003e # 3.5+\nLink: http://lkml.kernel.org/r/1349308004-3482-1-git-send-email-fweisbec@gmail.com\nSigned-off-by: Ingo Molnar \u003cmingo@kernel.org\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "f423bdd035c2234fb91910b60d096992405a28ba",
      "old_mode": 33188,
      "old_path": "kernel/time/tick-sched.c",
      "new_id": "a40260885265707603d72dee9df79f030e973221",
      "new_mode": 33188,
      "new_path": "kernel/time/tick-sched.c"
    }
  ]
}
