From: Peter Zijlstra <peterz@infradead.org>
To: Waiman Long <longman@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@kernel.org>,
Darren Hart <dvhart@infradead.org>,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
Davidlohr Bueso <dave@stgolabs.net>
Subject: Re: [PATCH] futex: Consolidate duplicated timer setup code
Date: Wed, 24 Apr 2019 18:09:54 +0200 [thread overview]
Message-ID: <20190424160954.GP11158@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20190424153651.15002-1-longman@redhat.com>
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.
next prev parent reply other threads:[~2019-04-24 16:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-24 15:36 [PATCH] futex: Consolidate duplicated timer setup code Waiman Long
2019-04-24 16:09 ` Peter Zijlstra [this message]
2019-04-24 16:32 ` Waiman Long
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190424160954.GP11158@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=dave@stgolabs.net \
--cc=dvhart@infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox