Re: [RFC] Scalable statistics counters using kmalloc_percpu

Ravikiran G Thirumalai (kiran@in.ibm.com)
Mon, 29 Jul 2002 19:48:25 +0530


On Fri, Jul 26, 2002 at 12:27:40PM -0300, Rik van Riel wrote:
> On Fri, 26 Jul 2002, Ravikiran G Thirumalai wrote:
>
> > Rik, You were interested in using this. Does this implementation suit
> > your needs?
>
> >From a quick glance it looks like it will.
>
> However, it might be more efficient to put the statistics
> in one file in /proc with named fields, or have a way to
> group them in one or multiple files.
>

Ok, Here's what I have in mind;
Introduce a statctr_base_t type which represents a group of counters on
the same proc file, have statctr_base_init and statctr_base_cleanup
to create and destroy these datatypes. Each line in the /proc file
will be of the form
countername value

Here are the changed and new interfaces:
1. int statctr_init(statctr_t *statctr, unsigned long value,
statctr_base_t *base, const char *countername, int flags);
2. void statctr_cleanup(statctr_t *);
3. int statctr_base_init(statctr_base_t *base,
struct proc_dir_entry *procbase, const char *procname);
4. extern void statctr_base_cleanup(satctr_base_t *base);

Does this look ok?

> Not sure about that, though ... really depends on how
> expensive stat+open+read+close is compared to parsing a
> file with multiple fields.
>

Also, when you group counters into a single file, you inadvertently
end up reading counters you may not require at that time.
Reads to statctrs are not as cheap as cpu local writes. You'll have to
take that into account too i guess .....

Thanks,
Kiran
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/