Re: [RFC] [PATCH] Performance of del_timer_sync

From: Ingo Molnar
Date: Tue May 11 2004 - 15:28:15 EST



* Andrew Morton <akpm@xxxxxxxx> wrote:

> Ah, OK, the timer handler may re-add itself. Really, that's a bug in
> the caller: once they've decided to shoot down the timer the caller
> should have made state changes which prevent the handler from
> re-adding the timer.
>
> Still, too late to change that.

yeah.

> Neither AIO nor schedule_timeout() actually re-add the timer so they
> don't need the full treatment, yes?

correct.

> +int del_single_shot_timer(struct timer_struct *timer)
> +{
> + if (del_timer(timer))
> + del_timer_sync(timer);
> +}

cool, this looks good to me. It's obviously correct and has a limited
scope. (I'd suggest another name though: del_timer_singleshot(). This i
think fits into the existing naming better: del_timer() and
del_timer_sync(). But no strong feelings either way.)

Ingo
-
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/