lkml.org 
[lkml]   [2019]   [Apr]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] futex: Consolidate duplicated timer setup code
From
Date
On 4/24/19 12:09 PM, Peter Zijlstra wrote:
> On Wed, Apr 24, 2019 at 11:36:51AM -0400, Waiman Long wrote:
>> +static inline struct hrtimer_sleeper *
>> +futex_setup_timer(ktime_t *time, struct hrtimer_sleeper *timeout,
>> + int flags, u64 range_ns)
>> +{
>> + if (!time)
>> + return NULL;
>> +
>> + hrtimer_init_on_stack(&timeout->timer, (flags & FLAGS_CLOCKRT) ?
>> + CLOCK_REALTIME : CLOCK_MONOTONIC,
>> + HRTIMER_MODE_ABS);
>> + hrtimer_init_sleeper(timeout, current);
>> + if (range_ns)
>> + hrtimer_set_expires_range_ns(&timeout->timer, *time, range_ns);
>> + else
>> + hrtimer_set_expires(&timeout->timer, *time);
> That can be an unconditinoal:
>
> hrtimer_set_expires_range_ns(&timeout->timer, *time, range_ns);
>
> See how:
>
> timer->node.expires = ktime_add_safe(time, ns_to_ktime(delta));
>
> is the same as:
>
> timer->node.expires = time;
>
> when !delta.


That is true. I will update it accordingly.

Thanks,
Longman

\
 
 \ /
  Last update: 2019-04-24 18:32    [W:0.034 / U:0.900 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site