posixtimers, sched: Fix posix clock monotonicity
commit39cd13c96cfc4d9d5992e93625fe6d6cb4fe3991
authorHidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Thu, 9 Apr 2009 18:20:12 +0000 (9 18:20 +0000)
committerChris Wright <chrisw@sous-sol.org>
Mon, 27 Apr 2009 17:36:59 +0000 (27 10:36 -0700)
tree41b89ecc74fe3c67e50b1495f21b3546b7d07f41
parent22f45438e5e7369f7c3a384a41616affd200b840
posixtimers, sched: Fix posix clock monotonicity

upstream commit: c5f8d99585d7b5b7e857fabf8aefd0174903a98c

Impact: Regression fix (against clock_gettime() backwarding bug)

This patch re-introduces a couple of functions, task_sched_runtime
and thread_group_sched_runtime, which was once removed at the
time of 2.6.28-rc1.

These functions protect the sampling of thread/process clock with
rq lock.  This rq lock is required not to update rq->clock during
the sampling.

i.e.
  The clock_gettime() may return
   ((accounted runtime before update) + (delta after update))
  that is less than what it should be.

v2 -> v3:
- Rename static helper function __task_delta_exec()
  to do_task_delta_exec() since -tip tree already has
  a __task_delta_exec() of different version.

v1 -> v2:
- Revises comments of function and patch description.
- Add note about accuracy of thread group's runtime.

Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: stable@kernel.org [2.6.28.x][2.6.29.x]
LKML-Reference: <49D1CC93.4080401@jp.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
kernel/posix-cpu-timers.c
kernel/sched.c