Re: [RFC] A more general timeout specification

From: Andi Kleen
Date: Wed May 18 2005 - 18:50:56 EST


Joe Korty <joe.korty@xxxxxxxx> writes:

> The fusyn (robust mutexes) project proposes the creation
> of a more general data structure, 'struct timeout', for the
> specification of timeouts in new services. In this structure,
> the user specifies:
>
> a time, in timespec format.
> the clock the time is specified against (eg, CLOCK_MONOTONIC).
> whether the time is absolute, or relative to 'now'.

If you do a new structure for this I would suggest adding a
"precision" field (or the same with a different name). Basically
precision would tell the kernel that the wakeup can be in a time
range, not necessarily on the exact time specified. This helps
optimizing the idle loop because you can batch timers better and is
important for power management and virtualized environments. The
kernel internally does not use support this yet, but there are plans
to change the internal timers in this direction and if you're defining
a new user interface I would add support for this.

I am not sure precision would be the right name, other suggestions
are welcome.

> Also proposed are two new kernel routines for the manipulation
> of timeouts:
>
> timeout_validate()
> timeout_sleep()
>
> timeout_validate() error-checks the syntax of a timeout
> argument and returns either zero or -EINVAL. By breaking
> timeout_validate() out from timeout_sleep(), it becomes possible

It is also useful to avoid code duplication in compat.


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