public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeff Garzik <jeff@garzik.org>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: "H. Peter Anvin" <hpa@zytor.com>,
	Christoph Lameter <cl@linux.com>,
	Alok Kataria <akataria@vmware.com>, Ingo Molnar <mingo@elte.hu>,
	Thomas Gleixner <tglx@linutronix.de>,
	the arch/x86 maintainers <x86@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] x86: Reduce the default HZ value
Date: Thu, 07 May 2009 13:55:42 -0400	[thread overview]
Message-ID: <4A03209E.4070603@garzik.org> (raw)
In-Reply-To: <20090507180909.4b0a8672@lxorguk.ukuu.org.uk>

Alan Cox wrote:
> On Thu, 07 May 2009 12:55:05 -0400
> Jeff Garzik <jeff@garzik.org> wrote:
> 
>> H. Peter Anvin wrote:
>>> Alan Cox wrote:
>>>> Hooray - finally someone admits the *real* problem here, and for power
>>>> management too. Otherwise known as "referencing jiffies as a variable must
>>>> die"
>>> Amen.  Also, "using HZ as a unit of measurement must die, too."
>> Love to -- now, what will it be replaced with?
>>
>> grep for 'deadline' in drivers/ata/libata* to find an example not so 
>> easily converted away from jiffies.
> 
> I don't see any.
> 
> I do see a complicated interface that appears to actually really want to
> implement
> 
> 		add_timer(&foo->expiry_timer);
> 
> and checks against the timer completing. In fact it looks as if all the
> stuff in there is really down to
> 
> 		add a timer
> 		check if it expired
> 		check how long until it expires
> 		delete it

This is why I mentioned this example... because it's not as easy as you 
seem to think it is :)

We care only about a decreasing time interval.  This interval is passed 
to register polling functions (bitbang no longer than <this> amount of 
time), as well as _cumulatively_ affecting the entire EH [sub-]process.

A timer-based solution, in addition to being an ugly hack, would imply 
replacing a simple variable with _at least_ two spinlocks, plus a timer 
callback function that simply says "I expired".  With loops such as

	max_msecs = calc_deadline(overall_deadline, ...)
	while (!(register & bit))
		msleep(1)
		max_msecs--
		register = readl(...)

must be converted to the more-complex timer-based solution.		

libata would be happy to use milliseconds rather than jiffies; the unit 
does not matter.  What matters is calculating our progress versus the 
clock tick, as spread across multiple functions, multiple contexts, and 
register polling loops.

The current code is a -lot- more simple than checking "is timer 
expired?" all over the code, given that any sort of timer-based function 
implies dealing with additional concurrency issues -- a complication the 
libata EH does not need.

	Jeff




  reply	other threads:[~2009-05-07 17:57 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-04 18:44 [PATCH] x86: Reduce the default HZ value Alok Kataria
2009-05-05 21:21 ` H. Peter Anvin
2009-05-05 21:44   ` Alan Cox
2009-05-05 22:09     ` Alok Kataria
2009-05-05 22:33       ` Alan Cox
2009-05-05 23:37         ` Alok Kataria
2009-05-07 14:09         ` Christoph Lameter
2009-05-07 15:12           ` Alan Cox
2009-05-05 21:57   ` Alok Kataria
2009-05-07 14:13     ` Christoph Lameter
2009-05-07 15:14       ` Alan Cox
2009-05-07 15:20         ` Christoph Lameter
2009-05-07 15:30         ` H. Peter Anvin
2009-05-07 15:40           ` Christoph Lameter
2009-05-07 16:55           ` Jeff Garzik
2009-05-07 17:09             ` Alan Cox
2009-05-07 17:55               ` Jeff Garzik [this message]
2009-05-07 19:51                 ` Alan Cox
2009-05-07 20:03                   ` Jeff Garzik
2009-05-07 20:30                     ` Alan Cox
2009-05-07 16:37         ` Alok Kataria
2009-05-07 17:07       ` Peter Zijlstra
2009-05-07 17:13         ` Peter Zijlstra
2009-05-07 17:18           ` Peter Zijlstra
2009-05-07 17:20             ` Christoph Lameter
2009-05-07 17:39               ` Peter Zijlstra
2009-05-07 17:40                 ` Christoph Lameter
2009-05-07 17:54               ` Paul E. McKenney
2009-05-07 17:51                 ` Christoph Lameter
2009-05-07 19:51                   ` Paul E. McKenney
2009-05-07 17:36             ` Paul E. McKenney
2009-05-07 17:38               ` Peter Zijlstra
2009-05-07 18:01                 ` Paul E. McKenney
2009-05-07 18:12                   ` Christoph Lameter
2009-05-07 19:06                     ` Paul E. McKenney
2009-05-07 19:53                     ` Alan Cox
2009-05-07 19:56                       ` Christoph Lameter
2009-05-07 20:24                         ` Alan Cox
2009-05-07 20:21                           ` Christoph Lameter
2009-05-08 10:32                   ` Peter Zijlstra
2009-05-08 12:50                     ` Paul E. McKenney
2009-05-08 14:16                       ` Christoph Lameter
2009-05-08 15:06                         ` Paul E. McKenney
2009-05-07 17:18           ` Christoph Lameter
2009-05-07 17:37             ` Peter Zijlstra
2009-05-07 17:34               ` Christoph Lameter
2009-05-07 17:55                 ` Peter Zijlstra
2009-05-07 17:55                   ` Christoph Lameter
2009-05-07 17:19         ` Christoph Lameter
2009-05-07 17:45           ` Peter Zijlstra
2009-05-07 17:50             ` Christoph Lameter
2009-05-07 19:17               ` Peter Zijlstra
2009-05-07 19:38                 ` Christoph Lameter
2009-05-07 21:01             ` H. Peter Anvin
2009-05-07 16:35     ` Chris Snook
2009-05-07 16:56       ` Alok Kataria
2009-05-07 20:29         ` Chris Snook
2009-05-07 20:34           ` Alan Cox
2009-05-07 22:16             ` Ravikiran G Thirumalai
2009-05-07 22:19             ` Alok Kataria
2009-05-08  9:31               ` Alan Cox
  -- strict thread matches above, loose matches on Subject: below --
2009-05-12 19:45 devzero
2009-05-13 23:30 ` Alok Kataria
2009-05-14 20:25 devzero
2009-05-14 20:29 ` Alan Cox

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=4A03209E.4070603@garzik.org \
    --to=jeff@garzik.org \
    --cc=akataria@vmware.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=cl@linux.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.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