lkml.org 
[lkml]   [2021]   [May]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/6] delayacct: Use sched_clock()
On Wed, May 05, 2021 at 12:59:41PM +0200, Peter Zijlstra wrote:
> @@ -42,10 +42,9 @@ void __delayacct_tsk_init(struct task_st
> * Finish delay accounting for a statistic using its timestamps (@start),
> * accumalator (@total) and @count
> */
> -static void delayacct_end(raw_spinlock_t *lock, u64 *start, u64 *total,
> - u32 *count)
> +static void delayacct_end(raw_spinlock_t *lock, u64 *start, u64 *total, u32 *count)
> {
> - s64 ns = ktime_get_ns() - *start;
> + s64 ns = local_clock() - *start;

I don't think this is safe. These time sections that have preemption
and migration enabled and so might span multiple CPUs. local_clock()
could end up behind *start, AFAICS.

\
 
 \ /
  Last update: 2021-05-06 16:01    [W:0.390 / U:0.644 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site