• Hidetoshi Seto's avatar
    posixtimers, sched: Fix posix clock monotonicity · c5f8d995
    Hidetoshi Seto authored
    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: default avatarHidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
    Acked-by: default avatarPeter 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: default avatarIngo Molnar <mingo@elte.hu>
    c5f8d995
sched.c 235 KB