Re: + posix-timer-cleanup-common_timer_get.patch added to -mm tree

From: Roman Zippel
Date: Wed Mar 15 2006 - 20:14:19 EST


Hi,

On Wed, 15 Mar 2006, Thomas Gleixner wrote:

> - if (timr->it.real.interval.tv64 == 0) {
> + if (iv.tv64)

Just for the record: this wasn't my bug... :)

> + if (iv.tv64 && (timr->it_requeue_pending & REQUEUE_PENDING ||
> + (timr->it_sigev_notify & ~SIGEV_THREAD_ID) == SIGEV_NONE))
> + timr->it_overrun += hrtimer_forward(timer, now, iv);

The iv.tv64 test is only needed for the SIGEV_NONE case, so one could also
move it to the end:

if ((timr->it_requeue_pending & REQUEUE_PENDING) ||
((timr->it_sigev_notify & ~SIGEV_THREAD_ID) == SIGEV_NONE && iv.tv64))

OTOH since it_requeue_pending is unused for SIGEV_NONE, we could as well
initialize it during timer_set:

if (timr->it_sigev_notify & ~SIGEV_THREAD_ID) == SIGEV_NONE)
timr->it_requeue_pending == interval.tv64 ? REQUEUE_PENDING : 0;

and make the test even simpler.

> + if (remaining.tv64 <= 0) {
> + /*
> + * A single shot SIGEV_NONE timer must return 0, when
> + * it is expired !
> + */
> + if ((timr->it_sigev_notify & ~SIGEV_THREAD_ID) != SIGEV_NONE)
> + cur_setting->it_value.tv_nsec = 1;

It's maybe practically not relevant, but theoretically a (iv.tv64) would
be more correct and then we could also move it up to the initial (iv.tv64)
test and leave the (remaining.tv64 > 0) case here.

bye, Roman
-
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/