2005-10-26 04:03:11

by Bharata B Rao

[permalink] [raw]
Subject: [PATCH] slab cache shrinker statistics

Hi Andrew,

Could you please consider including this patch into your mm tree ?

This patch collects data about how a shrinkable cache is behaving
over time. The number of objects scanned for shrinking
the cache and the actual number of objects freed are reported by
this patch as part of /proc/slabinfo. I have verified that adding
addtional elements to /proc/slabinfo isn't breaking slabtop.

I have made this patch on suggestions from Marcelo and he feels that
it is useful to have this in mm/mainline. This work started as an attempt
to break the slabs_scanned(from /proc/vmstat) into meaningful pieces
to reflect how individual cache behaves wrt memory reclaim.

A typical output from /proc/slabinfo after this patch looks like this:

[root@llm09 ~]# grep shrinker /proc/slabinfo
# name <active_objs> <num_objs> <objsize> <objperslab> <pagesperslab>
: tunables <limit> <batchcount> <sharedfactor> : slabdata <active_slabs> <num_s
labs> <sharedavail> : shrinker stat <nr requested> <nr freed>
ext3_xattr 0 0 48 78 1 : tunables 120 60 8 : sla
bdata 0 0 0 : shrinker stat 0 0
d_cursor 0 0 64 59 1 : tunables 120 60 8 : sla
bdata 0 0 0 : shrinker stat 0 0
dquot 0 0 160 24 1 : tunables 120 60 8 : sla
bdata 0 0 0 : shrinker stat 0 0
inode_cache 1262 1400 400 10 1 : tunables 54 27 8 : sla
bdata 140 140 0 : shrinker stat 376704 380400
dentry_cache 10449 10504 152 26 1 : tunables 120 60 8 : sla
bdata 404 404 0 : shrinker stat 859136 401700

Note: mbcache maintains multiple caches with a single shrinker routine.
Hence with this patch, all caches which are part of mbcache (like ext3_xattr
above) will display the combined shrinker statistics of mbcache and not
the shrinker attempts of individual caches. Or should I just drop the
stats collection from mbcache ?

Regards,
Bharata.


Attachments:
(No filename) (2.00 kB)
cache_shrink_stats.patch (9.23 kB)
Download all attachments

2005-10-26 04:25:10

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH] slab cache shrinker statistics

Bharata B Rao <[email protected]> wrote:
>
> Could you please consider including this patch into your mm tree ?

Spose so. I think it's a bit too much of a developer thing to go upstream
though.