Re: [PATCH] USB: improve ehci_watchdog's side effect in CPU powermanagement
From: Alan Stern
Date: Fri Oct 03 2008 - 10:52:02 EST
Responding just Andrew's comments, disregarding whether or not the
patch itself is worthwhile...
On Thu, 2 Oct 2008, Andrew Morton wrote:
> <looks>
>
> <regrets it>
>
>
> Why does this:
>
> t = DIV_ROUND_UP(EHCI_SHRINK_FRAMES * HZ, 1000) + 1;
>
> add "1000" to a jiffies value when it doesn't know what HZ is? It'll
> be adding anywhere from one second up to ten seconds to the timeout
> interval depending upon compile-time options.
Look again. The macro doesn't _add_ 1000 to a jiffies value; it
_divides_ the value by 1000. This is because EHCI_SHRINK_FRAMES is in
milliseconds.
However this could be changed to
t = msecs_to_jiffies(EHCI_SHRINK_FRAMES) + 1;
even though that would involve more runtime code.
> I suspect s/1000/HZ/ would improve things here. Or just delete it -
> doesn't the subsequent round_jiffies() do the same thing, only better?
> This code needs help, I suspect.
That subsequent round_jiffies() is most likely a mistake.
> Also, do we really need to inline this large function into at least
> five callsites?
I agree; this function should not be inline.
Alan Stern
--
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/