linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Han Pingtian <hanpt@linux.vnet.ibm.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Christoph Lameter <cl@linux.com>,
	mhocko@suse.cz, penberg@kernel.org, rientjes@google.com,
	linux-mm@kvack.org
Subject: Re: OOM-killer and strange RSS value in 3.9-rc7
Date: Fri, 26 Apr 2013 14:24:36 +0800	[thread overview]
Message-ID: <20130426062436.GB4441@localhost.localdomain> (raw)
In-Reply-To: <0000013e427023d7-9456c313-8654-420c-b85a-cb79cc3c4ffc-000000@email.amazonses.com>

On Thu, Apr 25, 2013 at 06:24:05PM +0000, Christoph Lameter wrote:
> On Thu, 25 Apr 2013, Han Pingtian wrote:
> 
> > > A dump of the other fields in /sys/kernel/slab/kmalloc*/* would also be
> > > useful.
> > >
> > I have dumpped all /sys/kernel/slab/kmalloc*/* in kmalloc.tar.xz and
> > will attach it to this mail.
> 
> Ok that looks like a lot of objects were freed from slab pages but the
> slab pages were not freed.
> 
> looking at kmalloc-8192 we have
> 
> Total capacity of the slab cache is 27k objects but only 508 are in use.
> 
> Looks like slab pages are not freed when all objects in them have been
> released.
> 
> The relevant portion of code that do the freeing are in
> 
> mm/slub.c::unfreeze_partials()
> 
> 		if (unlikely(!new.inuse && n->nr_partial > s->min_partial)) {
>                         page->next = discard_page;
>                         discard_page = page;
>                 } else {
>                         add_partial(n, page, DEACTIVATE_TO_TAIL);
>                         stat(s, FREE_ADD_PARTIAL);
>                 }
> 
> 
> ..
> 
>        while (discard_page) {
>                 page = discard_page;
>                 discard_page = discard_page->next;
> 
>                 stat(s, DEACTIVATE_EMPTY);
>                 discard_slab(s, page);
>                 stat(s, FREE_SLAB);
>         }
> 
> and mm/slub.c::__slab_free()
> 
>      if (unlikely(!new.inuse && n->nr_partial > s->min_partial))
>                 goto slab_empty;
> 
> 
> Could you verify the values of nr_partial and min_partial and verify that
> the free paths are actually used?

Could you give me some hints about how to verify them? Only I can do is
adding two printk() statements to print the vaules in those two
functions:

--------------------------------------------------------------------------------
diff --git a/mm/slub.c b/mm/slub.c
index 4aec537..d08d62d 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1915,6 +1915,9 @@ static void unfreeze_partials(struct kmem_cache *s,
                                new.freelist, new.counters,
                                "unfreezing slab"));
 
+               if (strcmp(s->name, "kmalloc-8192") == 0) {
+                       printk(KERN_INFO "In unfreeze_partials(); kmalloc-8192: n->nr_partial=%lu, s->min_partial
+                }
                if (unlikely(!new.inuse && n->nr_partial > s->min_partial)) {
                        page->next = discard_page;
                        discard_page = page;
@@ -2536,6 +2539,10 @@ static void __slab_free(struct kmem_cache *s, struct page *page,
                 return;
         }
 
+       if (strcmp(s->name, "kmalloc-8192") == 0) {
+               printk(KERN_INFO "In __slab_free(); kmalloc-8192: n->nr_partial=%lu, s->min_partial=%lu\n", n->nr
+       }
+
        if (unlikely(!new.inuse && n->nr_partial > s->min_partial))
                goto slab_empty;

--------------------------------------------------------------------------------

And looks like only printk() in __slab_free() is invoked. I got about 6764 
lines of something like this:

--------------------------------------------------------------------------------
Apr 26 01:04:05 riblp3 kernel: [    6.969775] In __slab_free(); kmalloc-8192: n->nr_partial=2, s->min_partial=6
Apr 26 01:04:05 riblp3 kernel: [    6.970154] In __slab_free(); kmalloc-8192: n->nr_partial=3, s->min_partial=6
Apr 26 01:04:05 riblp3 kernel: [    6.979489] In __slab_free(); kmalloc-8192: n->nr_partial=4, s->min_partial=6
Apr 26 01:04:05 riblp3 kernel: [    6.979823] In __slab_free(); kmalloc-8192: n->nr_partial=5, s->min_partial=6
Apr 26 01:04:05 riblp3 kernel: [    9.500383] In __slab_free(); kmalloc-8192: n->nr_partial=7, s->min_partial=6
Apr 26 01:04:05 riblp3 kernel: [    9.509736] In __slab_free(); kmalloc-8192: n->nr_partial=7, s->min_partial=6
Apr 26 01:04:08 riblp3 kernel: [   42.314395] In __slab_free(); kmalloc-8192: n->nr_partial=100, s->min_partial=6
Apr 26 01:04:08 riblp3 kernel: [   42.410333] In __slab_free(); kmalloc-8192: n->nr_partial=100, s->min_partial=6
Apr 26 01:04:09 riblp3 kernel: [   43.411851] In __slab_free(); kmalloc-8192: n->nr_partial=339, s->min_partial=6
Apr 26 01:04:09 riblp3 kernel: [   43.411980] In __slab_free(); kmalloc-8192: n->nr_partial=338, s->min_partial=6
Apr 26 01:04:09 riblp3 kernel: [   43.412083] In __slab_free(); kmalloc-8192: n->nr_partial=337, s->min_partial=6
--------------------------------------------------------------------------------
The s->min_partial is always "6" and most of n->nr_partial is bigger than 
its partner of the same line.

Thanks.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2013-04-26  6:24 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <alpine.DEB.2.02.1304161315290.30779@chino.kir.corp.google.com>
     [not found] ` <20130417094750.GB2672@localhost.localdomain>
     [not found]   ` <20130417141909.GA24912@dhcp22.suse.cz>
     [not found]     ` <20130418101541.GC2672@localhost.localdomain>
     [not found]       ` <20130418175513.GA12581@dhcp22.suse.cz>
     [not found]         ` <20130423131558.GH8001@dhcp22.suse.cz>
     [not found]           ` <20130424044848.GI2672@localhost.localdomain>
2013-04-24  9:47             ` OOM-killer and strange RSS value in 3.9-rc7 Michal Hocko
2013-04-24 15:36               ` Christoph Lameter
2013-04-25  6:07                 ` Han Pingtian
2013-04-25 17:17                   ` Christoph Lameter
2013-04-27  8:20                     ` Will Huck
2013-04-29 14:49                       ` Christoph Lameter
2013-05-01  3:13                         ` Will Huck
2013-05-02 15:10                           ` Christoph Lameter
2013-05-09 13:17                             ` Will Huck
2013-05-09 14:00                               ` Christoph Lameter
2013-05-10  0:42                                 ` Will Huck
2013-05-10 16:00                                   ` Christoph Lameter
2013-04-25 18:24                   ` Christoph Lameter
2013-04-26  6:24                     ` Han Pingtian [this message]
2013-04-26 14:42                       ` Christoph Lameter
2013-04-27 11:24                         ` Han Pingtian
2013-04-29 14:50                           ` Christoph Lameter
2013-04-29 14:57                             ` Michal Hocko
2013-05-02 10:56                               ` Han Pingtian
2013-05-02 15:10                                 ` Christoph Lameter
2013-05-03  3:03                                   ` Han Pingtian
2013-05-03 15:25                                     ` Christoph Lameter
2013-05-03 15:34                                       ` Michal Hocko
2013-05-03 16:16                                         ` Christoph Lameter
2013-12-27 10:39                                           ` Wanpeng Li
2014-01-06 13:15                                             ` Wanpeng Li
     [not found]                                             ` <52caac5c.27cb440a.533d.ffffbbd2SMTPIN_ADDED_BROKEN@mx.google.com>
2014-01-21 22:12                                               ` David Rientjes
2014-01-22 23:45                                                 ` Wanpeng Li
2013-04-25  5:41               ` Han Pingtian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130426062436.GB4441@localhost.localdomain \
    --to=hanpt@linux.vnet.ibm.com \
    --cc=cl@linux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.cz \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).