Re: [PATCH RFC 1/3] Add a trigger API for efficient non-blockingwaiting

From: Randy Dunlap
Date: Sun Aug 17 2008 - 19:02:13 EST


On Sat, 16 Aug 2008 09:34:13 -0700 Jeremy Fitzhardinge wrote:

> --- /dev/null
> +++ b/include/linux/trigger.h
> @@ -0,0 +1,145 @@
> +#ifndef _LINUX_TRIGGER_H
> +#define _LINUX_TRIGGER_H
> +
> +
> +
> +/**
> + * trigger_init - Initialize a trigger for use
> + * @t - trigger to be initialized

kernel-doc format for function parameters is like:

* @t: trigger to be initialized

so please change all occurrences to be like that. Thanks.


> + */
> +static inline void trigger_init(trigger_t *t)
> +{
> + __raw_trigger_init(t);
> +}
> +
> +/**
> + * trigger_reset - reset a trigger
> + * @t - trigger to be reset
> + *
> + * This resets the trigger state, allowing a trigger_wait to block.
> + * Note that preemption must be disabled between trigger_reset() and
> + * trigger_finish().
> + *
> + * The use of these functions is:
> + * trigger_reset(&t);
> + * while(!condition)
> + * trigger_wait(&t);
> + * trigger_finish(&t);
> + *
> + * and where the condition is set:
> + * condition = true;
> + * trigger_kick(&t);
> + */
> +static inline void trigger_reset(trigger_t *t)
> +{
> + __raw_trigger_reset(t);
> +}
> +
> +/**
> + * trigger_wait - wait for a trigger to be kicked
> + * @t - trigger to be waited on
> + *
> + * This blocks until the trigger has been kicked. If the trigger has
> + * already been kicked, it will return immediately. It may also
> + * return without the trigger having been kicked at all; the caller
> + * must test the condition before calling trigger_wait() again.
> + *
> + * trigger_wait() acts as a read barrier.
> + *
> + * On return, the trigger will have always be reset.
> + */
> +static inline void trigger_wait(trigger_t *t)
> +{
> + __raw_trigger_wait(t);
> +}
> +
> +/**
> + * trigger_kick - kick a trigger
> + * @t - trigger to kick
> + *
> + * This causes anyone waiting in trigger_wait to continue. It may be
> + * called in any context.
> + *
> + * trigger_kick() acts as a write barrier.
> + */
> +static inline void trigger_kick(trigger_t *t)
> +{
> + __raw_trigger_kick(t);
> +}
> +
> +/**
> + * trigger_finish - clean up trigger
> + * @t - trigger to be cleaned up
> + *
> + * This cleans up any implementation trigger state once we've finished
> + * with it.
> + */
> +static inline void trigger_finish(trigger_t *t)
> +{
> + __raw_trigger_finish(t);
> +}
> +#endif /* _LINUX_TRIGGER_H */


---
~Randy
Linux Plumbers Conference, 17-19 September 2008, Portland, Oregon USA
http://linuxplumbersconf.org/
--
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/