public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: <mingo@redhat.com>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] sched/clock: cleanup, remove wrap_{max|min}().
Date: Wed, 7 May 2014 21:04:19 +0900	[thread overview]
Message-ID: <536A2143.5090106@cn.fujitsu.com> (raw)
In-Reply-To: <20140507125548.GL30445@twins.programming.kicks-ass.net>

On 05/07/2014 09:55 PM, Peter Zijlstra wrote:
> On Wed, May 07, 2014 at 08:48:58PM +0900, Dongsheng Yang wrote:
>> I am not sure why we need the wrap_{max|min}() in kernel/sched/clock.c.
>> But I checked the implementation of max() and min() in linux/kernel.h, I think
>> we can reuse them here rather than introduce a new function named
>> wrap_{max|min}().
> wrap is a good hint there.. they're supposed to deal with the clock
> wrapping. Of course 2^64 ns is a rather long time (~584 years in fact),
> but that doesn't mean we shouldn't care.
>
> And no, min/max don't do the right thing.

IMMO,  max() in kernel.h is checking and returning the u64 with typeof() if
we are passing a u64 parameter to max(). And I checked current callers 
of wrap_max(),
they are all passing parameters of u64 type. So I think max/min works 
well at
the place of wrap_max/min().

Maybe I am missing something here, please correct me if I understand it 
incorrectly.

Thanx

  reply	other threads:[~2014-05-07 13:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-07 11:48 [PATCH] sched/clock: cleanup, remove wrap_{max|min}() Dongsheng Yang
2014-05-07 12:55 ` Peter Zijlstra
2014-05-07 12:04   ` Dongsheng Yang [this message]
2014-05-07 13:38     ` Peter Zijlstra

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=536A2143.5090106@cn.fujitsu.com \
    --to=yangds.fnst@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    /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