Messages in this thread | | | Date | Fri, 19 Sep 2008 22:32:41 +0200 | From | Andrea Righi <> | Subject | Re: [PATCH -mm 2/6] introduce struct res_counter_ratelimit |
| |
Randy Dunlap wrote: > 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@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. >
Sure! I will do for the next version. Actually, I'm already using the kernel-doc style in other parts of this patchset (i.e. to document iothrottle structures).
Thanks! -Andrea
| |