Re: [PATCH] x86: Reduce the default HZ value
From: Jeff Garzik
Date: Thu May 07 2009 - 16:05:41 EST
Alan Cox wrote:
jiffies is *really* expensive...
Certainly.
However you don't need HZ
Thus I said "libata would be happy to use milliseconds rather than
jiffies; the unit does not matter."
All crucial constants and variables are already in useful units, and we
are forced to convert them to jiffies, and test against 'jiffies' global
var, because the API does not provide other reasonable alternatives.
Pretty much all users of time -- including users of timers -- are forced
to convert from a useful unit of time to jiffies, because that's what
the API requires.
and you can do that really easily by making your timer switch a single
value to the correct state for the time and in your loops just checking
while ( ap->reset_state == WIBBLING_RANDOMLY) {
wobble = readl(ap->ioaddr.wibble);
mdelay(1);
if (wobble & WIBBLED) {
...
}
}
And when the deadline changes, you need mod_timer rather than a simple
non-global-variable increment.
And when you consider all the bits of state, spread across not only
libata core __but drivers as well__, a timer-based solution gets even
uglier.
But you're still missing the point. jiffies are just a unit, a unit
forced upon us by all the time-based kernel API functions that take
jiffies rather than usec or msec.
I would rather fix the API, than investigate hacky solutions that
complicate the code even more.
Jeff
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/