Re: [PATCH 3/12] ksm: pages_unshared and pages_volatile

From: Andrew Morton
Date: Tue Aug 04 2009 - 17:50:21 EST


On Mon, 3 Aug 2009 13:11:53 +0100 (BST)
Hugh Dickins <hugh.dickins@xxxxxxxxxxxxx> wrote:

> The pages_shared and pages_sharing counts give a good picture of how
> successful KSM is at sharing; but no clue to how much wasted work it's
> doing to get there. Add pages_unshared (count of unique pages waiting
> in the unstable tree, hoping to find a mate) and pages_volatile.
>
> 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.
>
> Also show full_scans: the number of completed scans of everything
> registered in the mm list.
>
> The locking for all these counts is simply ksm_thread_mutex.
>
> ...
>
> 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 ;)

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