[Devel] Re: [PATCH -mm 2/6] introduce struct res_counter_ratelimit
Randy Dunlap
randy.dunlap at oracle.com
Fri Sep 19 10:08:32 PDT 2008
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 at gmail.com>
> ---
> 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
_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
More information about the Devel
mailing list