LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Jens Axboe <jens.axboe@oracle.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Tejun Heo <tj@kernel.org>,
	Kernel development list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] Add round_jiffies_up and related routines
Date: Wed, 5 Nov 2008 20:11:27 +0100	[thread overview]
Message-ID: <20081105191126.GN21867@kernel.dk> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0811051115370.2573-100000@iolanthe.rowland.org>

On Wed, Nov 05 2008, Alan Stern wrote:
> On Wed, 5 Nov 2008, Tejun Heo wrote:
> 
> > Alan Stern wrote:
> > > This patch (as1158) adds round_jiffies_up() and friends.  These
> > > routines work like the analogous round_jiffies() functions, except
> > > that they will never round down.
> > > 
> > > The new routines will be useful for timeouts where we don't care
> > > exactly when the timer expires, provided it doesn't expire too soon.
> > > 
> > > Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
> > 
> > Heh... I have exactly the same patches but mines were named
> > round_up_jiffies().
> 
> To an American, "round_up_jiffies" sounds like something a cowboy might 
> do.  :-)
> 
> I haven't bothered to look throughout the kernel to see where 
> round_jiffies_up() could be used.  Have you done this?

Heh, I do agree :-)

> > > +	unsigned long j0 = jiffies;
> > > +
> > > +	barrier();	/* Prevent the compiler from aliasing j0 and jiffies */
> > > +	return round_jiffies_common(j + j0, cpu, false) - j0;
> > 
> > jiffies is volatile.  No need for explicit barrier,
> 
> I didn't realize that.  Good, it makes things easier.
> 
> > but this part is
> > necessary for correct operation as if jiffies go up by two the
> > calculation will wrap and the returned value will be very large.  I
> > think this fix deserves a separate patch and proper explanation.
> 
> How about if I remove the barrier() call?  Should this new code still
> go in a separate patch?

I think it's fine as-is without the barrier. Can you resend it as such,
makes it easier to merge up (plus, it does need a new signed-off-by).

-- 
Jens Axboe


  reply	other threads:[~2008-11-05 19:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-04 16:15 Alan Stern
2008-11-05  3:33 ` Tejun Heo
2008-11-05 16:20   ` Alan Stern
2008-11-05 19:11     ` Jens Axboe [this message]
2008-11-05 21:18       ` [PATCH 1/2 ver 2] " Alan Stern
2008-11-06  7:42         ` Jens Axboe

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=20081105191126.GN21867@kernel.dk \
    --to=jens.axboe@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    --cc=tj@kernel.org \
    --subject='Re: [PATCH 1/2] Add round_jiffies_up and related routines' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).