[RFC][PATCH 0/5] sched: Diagnostic checks for missing rq clock updates

From: Matt Fleming
Date: Thu May 12 2016 - 15:50:03 EST


There are currently no runtime diagnostic checks for detecting when we
have inadvertently missed a call to update_rq_clock() before accessing
rq_clock().

The idea in these patches, which came from Peter, is to piggyback on
the rq->lock pin/unpin context to detect when we expected (and failed)
to see an update to the rq clock. They've already caught a couple of
bugs: see patch 1 and commit b52fad2db5d7 ("sched/fair: Update rq
clock before updating nohz CPU load") in tip/sched/core.

I'm not sure how palatable the s/pin_cookie/rq_flags/ changes will be
in patch 2, so I've marked this entire series as RFC.

All the diagnostic code is guarded by CONFIG_SCHED_DEBUG, but there
are minimal changes to __schedule() in patch 5 for the !SCHED_DEBUG
case.

Matt Fleming (5):
sched/fair: Update the rq clock before detaching tasks
sched: Add wrappers for lockdep_(un)pin_lock()
sched/core: Reset RQCF_ACT_SKIP before unpinning rq->lock
sched/fair: Push rq lock pin/unpin into idle_balance()
sched/core: Add debug code to catch missing update_rq_clock()

kernel/sched/core.c | 94 +++++++++++++++++++++++--------------------
kernel/sched/deadline.c | 10 ++---
kernel/sched/fair.c | 31 +++++++++------
kernel/sched/idle_task.c | 2 +-
kernel/sched/rt.c | 6 +--
kernel/sched/sched.h | 101 ++++++++++++++++++++++++++++++++++++++++-------
kernel/sched/stop_task.c | 2 +-
7 files changed, 166 insertions(+), 80 deletions(-)

--
2.7.3