mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-30 06:10:56 +00:00
sched/core: Validate rq_clock*() serialization
rq->clock{,_task} are serialized by rq->lock, verify this. One immediate fail is the usage in scale_rt_capability, so 'annotate' that for now, there's more 'funny' there. Maybe change rq->lock into a raw_seqlock_t? (Only 32-bit is affected) Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: http://lkml.kernel.org/r/20150105103554.361872747@infradead.org Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: umgwanakikbuti@gmail.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
parent
1b537c7d1e
commit
cebde6d681
2 changed files with 8 additions and 1 deletions
|
@ -5948,8 +5948,8 @@ static unsigned long scale_rt_capacity(int cpu)
|
||||||
*/
|
*/
|
||||||
age_stamp = ACCESS_ONCE(rq->age_stamp);
|
age_stamp = ACCESS_ONCE(rq->age_stamp);
|
||||||
avg = ACCESS_ONCE(rq->rt_avg);
|
avg = ACCESS_ONCE(rq->rt_avg);
|
||||||
|
delta = __rq_clock_broken(rq) - age_stamp;
|
||||||
|
|
||||||
delta = rq_clock(rq) - age_stamp;
|
|
||||||
if (unlikely(delta < 0))
|
if (unlikely(delta < 0))
|
||||||
delta = 0;
|
delta = 0;
|
||||||
|
|
||||||
|
|
|
@ -687,13 +687,20 @@ DECLARE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues);
|
||||||
#define cpu_curr(cpu) (cpu_rq(cpu)->curr)
|
#define cpu_curr(cpu) (cpu_rq(cpu)->curr)
|
||||||
#define raw_rq() raw_cpu_ptr(&runqueues)
|
#define raw_rq() raw_cpu_ptr(&runqueues)
|
||||||
|
|
||||||
|
static inline u64 __rq_clock_broken(struct rq *rq)
|
||||||
|
{
|
||||||
|
return ACCESS_ONCE(rq->clock);
|
||||||
|
}
|
||||||
|
|
||||||
static inline u64 rq_clock(struct rq *rq)
|
static inline u64 rq_clock(struct rq *rq)
|
||||||
{
|
{
|
||||||
|
lockdep_assert_held(&rq->lock);
|
||||||
return rq->clock;
|
return rq->clock;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline u64 rq_clock_task(struct rq *rq)
|
static inline u64 rq_clock_task(struct rq *rq)
|
||||||
{
|
{
|
||||||
|
lockdep_assert_held(&rq->lock);
|
||||||
return rq->clock_task;
|
return rq->clock_task;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue