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


Groups > linux.kernel > #1519682

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

From David Rientjes <rientjes@google.com>
Newsgroups linux.kernel
Subject Re: [patch] mm, slab: faster active and free stats
Date 2016-11-11 11:40 +0100
Message-ID <sChpw-392-31@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> <sCd2x-c0-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, 11 Nov 2016, Joonsoo Kim wrote:

> 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.
> 

Hi Joonsoo,

It's a good point, although I don't think the patch has overly complex 
logic to keep track of slab state.

We don't prefer to do any iteration in get_slabinfo() since users can 
read /proc/slabinfo constantly; it's better to just settle the stats when 
slab state changes instead of repeating an expensive operation over and 
over if someone is running slabtop(1) or /proc/slabinfo is scraped 
regularly for stats.

That said, I imagine there are more clever ways to arrive at the same 
answer, and you bring up a good point about maintaining a n->num_slabs and 
n->free_slabs rather than n->active_slabs and n->free_slabs.

I don't feel strongly about either approach, but I think some improvement, 
such as what this patch provides, is needed to prevent how expensive 
simply reading /proc/slabinfo can be.

Back to linux.kernel | Previous | NextPrevious 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