Re: [PATCH -mm 2/6] introduce struct res_counter_ratelimit

From: Randy Dunlap
Date: Fri Sep 19 2008 - 13:14:29 EST


On Wed, 17 Sep 2008 13:05:24 +0200 Andrea Righi wrote:

> Introduce res_counter_ratelimit as a generic structure to implement
> throttling-based cgroup subsystems.
>
> [ Only the interfaces needed by the IO controller are implemented right now ]
>
> Signed-off-by: Andrea Righi <righi.andrea@xxxxxxxxx>
> ---
> include/linux/res_counter.h | 70 +++++++++++++++++++++++++
> kernel/res_counter.c | 118 ++++++++++++++++++++++++++++++++++++++++++-
> 2 files changed, 187 insertions(+), 1 deletions(-)
>
> diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
> index 0ab55c4..ff677d9 100644
> --- a/include/linux/res_counter.h
> +++ b/include/linux/res_counter.h
> @@ -45,6 +46,38 @@ struct res_counter {
> spinlock_t lock;
> };
>
> +/* The various policies that can be used for throttling */
> +#define RATELIMIT_LEAKY_BUCKET 0
> +#define RATELIMIT_TOKEN_BUCKET 1
> +
> +struct res_counter_ratelimit {
> + /*
> + * the current resource consumption level
> + */
> + unsigned long long usage;
> + /*
> + * the maximal value of the usage from the counter creation
> + */
> + unsigned long long max_usage;
> + /*
> + * the rate limit that cannot be exceeded
> + */
> + unsigned long long limit;
> + /*
> + * the limiting policy / algorithm
> + */
> + unsigned long long policy;
> + /*
> + * timestamp of the last accounted resource request
> + */
> + unsigned long long timestamp;
> + /*
> + * the lock to protect all of the above.
> + * the routines below consider this to be IRQ-safe
> + */
> + spinlock_t lock;
> +};

With such nice struct comments, it looks like you should convert them
to kernel-doc for structs. See Documentation/kernel-doc-nano-HOWTO.txt
for into, or ask me if you need some help with it.

Thanks,
---
~Randy
--
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/