Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1519583

Re: [patch] mm, slab: faster active and free stats

From Joonsoo Kim <iamjoonsoo.kim@lge.com>
Newsgroups linux.kernel
Subject Re: [patch] mm, slab: faster active and free stats
Date 2016-11-11 07:00 +0100
Message-ID <sCd2x-c0-1@gated-at.bofh.it> (permalink)
References <sBnGG-7AF-27@gated-at.bofh.it> <sBnQm-7DS-9@gated-at.bofh.it> <sBLzj-6wR-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Nov 09, 2016 at 04:38:08PM -0800, David Rientjes wrote:
> On Tue, 8 Nov 2016, Andrew Morton wrote:
> 
> > > Reading /proc/slabinfo or monitoring slabtop(1) can become very expensive
> > > if there are many slab caches and if there are very lengthy per-node
> > > partial and/or free lists.
> > > 
> > > Commit 07a63c41fa1f ("mm/slab: improve performance of gathering slabinfo
> > > stats") addressed the per-node full lists which showed a significant
> > > improvement when no objects were freed.  This patch has the same
> > > motivation and optimizes the remainder of the usecases where there are
> > > very lengthy partial and free lists.
> > > 
> > > This patch maintains per-node active_slabs (full and partial) and
> > > free_slabs rather than iterating the lists at runtime when reading
> > > /proc/slabinfo.
> > 
> > Are there any nice numbers you can share?
> > 
> 
> Yes, please add this to the description:
> 
> 
> When allocating 100GB of slab from a test cache where every slab page is
> on the partial list, reading /proc/slabinfo (includes all other slab
> caches on the system) takes ~247ms on average with 48 samples.
> 
> As a result of this patch, the same read takes ~0.856ms on average.

Hello, David.

Maintaining acitve/free_slab counters looks so complex. And, I think
that we don't need to maintain these counters for faster slabinfo.
Key point is to remove iterating n->slabs_partial list.

We can calculate active slab/object by following equation as you did in
this patch.

active_slab(n) = n->num_slab - the number of free_slab
active_object(n) = n->num_slab * cachep->num - n->free_objects

To get the number of free_slab, we need to iterate n->slabs_free list
but I guess it would be small enough.

If you don't like to iterate n->slabs_free list in slabinfo, just
maintaining the number of slabs_free would be enough.

Thanks.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[patch] mm, slab: faster active and free stats David Rientjes <rientjes@google.com> - 2016-11-09 00:10 +0100
  Re: [patch] mm, slab: faster active and free stats Andrew Morton <akpm@linux-foundation.org> - 2016-11-09 00:20 +0100
    Re: [patch] mm, slab: faster active and free stats David Rientjes <rientjes@google.com> - 2016-11-10 01:40 +0100
      Re: [patch] mm, slab: faster active and free stats Joonsoo Kim <iamjoonsoo.kim@lge.com> - 2016-11-11 07:00 +0100
        Re: [patch] mm, slab: faster active and free stats David Rientjes <rientjes@google.com> - 2016-11-11 11:40 +0100

csiph-web