lkml.org 
[lkml]   [2020]   [Jul]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [RFC PATCH v2] Softirq:avoid large sched delay from the pending softirqs
Date
qianjun.kernel@gmail.com writes:
> +
> + end = ktime_get();
> + delta = ktime_to_us(end - start);

What's the point of this conversion? That's a division for no value
because you can simply define the maximum time in nanoseconds with the
same effect, i.e.

ktime_t end = ktime_get() + MAX_SOFTIRQ_TIME_NS;

if (need_resched() && ktime_get() > end)
break;

So you can spare all that start, delta and conversion dance and keep the
code simple.

Also notice that need_resched() wants to be evaluated first because
there is no point to do the more expensive time read if need_resched()
is false.

Thanks,

tglx

\
 
 \ /
  Last update: 2020-07-22 20:06    [W:0.102 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site