[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <df0884df-5044-893b-65e2-7ed17c078448@redhat.com>
Date: Wed, 24 Apr 2019 12:32:46 -0400
From: Waiman Long <longman@...hat.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...nel.org>,
Darren Hart <dvhart@...radead.org>,
linux-kernel@...r.kernel.org, linux-doc@...r.kernel.org,
Davidlohr Bueso <dave@...olabs.net>
Subject: Re: [PATCH] futex: Consolidate duplicated timer setup code
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
Powered by blists - more mailing lists