[lkml]   [2009]   [Aug]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 3/12] ksm: pages_unshared and pages_volatile
On Tue, 4 Aug 2009, Andrew Morton wrote:
> On Mon, 3 Aug 2009 13:11:53 +0100 (BST)
> Hugh Dickins <> wrote:
> > pages_volatile is harder to define. It includes those pages changing
> > too fast to get into the unstable tree, but also whatever other edge
> > conditions prevent a page getting into the trees: a high value may
> > deserve investigation. Don't try to calculate it from the various
> > conditions: it's the total of rmap_items less those accounted for.
> > static inline struct rmap_item *alloc_rmap_item(void)
> > {
> > - return kmem_cache_zalloc(rmap_item_cache, GFP_KERNEL);
> > + struct rmap_item *rmap_item;
> > +
> > + rmap_item = kmem_cache_zalloc(rmap_item_cache, GFP_KERNEL);
> > + if (rmap_item)
> > + ksm_rmap_items++;
> > + return rmap_item;
> > }
> ksm_rmap_items was already available via /proc/slabinfo. I guess that
> wasn't a particularly nice user interface ;)

procfs is not a nice interface for sysfs to be reading
when it's asked to show pages_volatile!

And not even always available, I think: SLOB wouldn't be able to report
the number of objects of any particular type, SLUB would need slub_nomerge
(or a debug flag) to keep the kmem_cache separate; and even SLAB would
have to assemble numbers from different cpus and queues, I guess.
Easier and more reliable for KSM to do its own thing here.

I do agree that slabinfo or slqbinfo or /proc/slabinfo is a good enough
interface for checking up on the number of rmap_items in use; it's what
I was using most of the time. I did once fleetingly wonder whether to
show the count of rmap_items under /sys/kernel/mm/ksm, but rejected it
as not interesting enough to deserve more than what slabinfo tells.

But here the rmap_item count is being used to deduce something more
interesting (though more obscure), and I don't want SL?B divergences
to perturb the resulting number more than it is already. I did start
out without the rmap_items count, incrementing and decrementing
pages_volatile all over the place; but soon abandoned that in
favour of the difference calculation.

But I think I'm taking you more seriously than you intended,
sorry for my humourlessness!


 \ /
  Last update: 2009-08-05 13:41    [W:0.100 / U:6.124 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site