[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190424160954.GP11158@hirez.programming.kicks-ass.net>
Date: Wed, 24 Apr 2019 18:09:54 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Waiman Long <longman@...hat.com>
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 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.
> +
> + return timeout;
> +}
Anyway, looks good otherwise.
Powered by blists - more mailing lists