The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Waiman Long <longman@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>
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 12:32:46 -0400	[thread overview]
Message-ID: <df0884df-5044-893b-65e2-7ed17c078448@redhat.com> (raw)
In-Reply-To: <20190424160954.GP11158@hirez.programming.kicks-ass.net>

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


      reply	other threads:[~2019-04-24 16:32 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
2019-04-24 16:32   ` Waiman Long [this message]

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=df0884df-5044-893b-65e2-7ed17c078448@redhat.com \
    --to=longman@redhat.com \
    --cc=dave@stgolabs.net \
    --cc=dvhart@infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.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