Re: preempt-timing-2.6.8-rc1

From: Nick Piggin
Date: Tue Jul 13 2004 - 08:02:43 EST


William Lee Irwin III wrote:
William Lee Irwin III wrote:

+ unsigned long preempt_exit
+ = (unsigned long)__builtin_return_address(0);
+ hold = sched_clock() - __get_cpu_var(preempt_timings) + 999999;
+ do_div(hold, 1000000);
+ if (preempt_thresh && hold > preempt_thresh &&
+ printk_ratelimit()) {


On Tue, Jul 13, 2004 at 10:51:24PM +1000, Nick Piggin wrote:

This looks wrong. This means hold times of 1ns to 1000000ns trigger the
exceeded 1ms threshold, 1000001 to 2000000 trigger the 2ms one, etc.
Removing the + 999999 gives the correct result:
1000000 - 1999999ns triggers the 1ms threshold
2000000 - 2999999ns triggers the 2ms threshold
etc
Or have I missed something?


AFAICT this is nothing more than rounding up.


But you want to round down by definition of preempt_thresh, don't you?

preempt_thresh = 1ms = 1000000us
ie. warn me if the lock hold goes _to or above_ 1000000us
-
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/