lkml.org 
[lkml]   [2002]   [Oct]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] 2.4: variable HZ
Hiya...  Nice patch, must try it when I find a few minutes - I think I
have a few apps that are limited by select/poll behaviour.

I was looking at your jiffies_to_clock_t() macro, and I notice that it
will screw up badly if the user chooses a HZ value that isn't a multiple
of the normal value (e.g. 1000 is OK, 512 isn't).

How about tweaking the macro a little? Instead of:
x / (HZ/USER_HZ)
you could use:
(x/HZ*USER_HZ + x%HZ*USER_HZ/HZ)

which minimises roundoff error and also won't overflow (at least, it
won't overflow as long as HZ*USER_HZ doesn't overflow!).

You could even use both versions of the macro, choosing between them at
compile time depending on whether or not (HZ % USER_HZ == 0).

What do you think?

cheers
Neil
PS: I'm off-list.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:30    [from the cache]
©2003-2011 Jasper Spaans