linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Qixuan Wu <wuqixuan@gmail.com>
To: Yang Shi <yang.s@alibaba-inc.com>
Cc: "cl@linux.com" <cl@linux.com>,
	"penberg@kernel.org" <penberg@kernel.org>,
	"rientjes@google.com" <rientjes@google.com>,
	"iamjoonsoo.kim@lge.com" <iamjoonsoo.kim@lge.com>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"mhocko@kernel.org" <mhocko@kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH 2/2] mm: oom: show unreclaimable slab info when kernel panic
Date: Sun, 24 Sep 2017 14:10:46 +0800	[thread overview]
Message-ID: <CAEjEV8DcOzh+TEeF4MmPTbAEq4ahCCCG3tiU975dhwauv2RgGQ@mail.gmail.com> (raw)
In-Reply-To: <1506109927-17012-3-git-send-email-yang.s@alibaba-inc.com>

On Sat, Sep 23, 2017, Yang Shi <yang.s@alibaba-inc.com> wrote:
>
> Kernel may panic when oom happens without killable process sometimes it
> is caused by huge unreclaimable slabs used by kernel.
>
> Although kdump could help debug such problem, however, kdump is not
> available on all architectures and it might be malfunction sometime.
> And, since kernel already panic it is worthy capturing such information
> in dmesg to aid touble shooting.
......

> +void dump_unreclaimable_slab(void)
> +{
> +       struct kmem_cache *s, *s2;
> +       struct slabinfo sinfo;
> +
> +       pr_info("Unreclaimable slab info:\n");
> +       pr_info("Name                      Used          Total\n");
> +
> +       /*
> +        * Here acquiring slab_mutex is unnecessary since we don't prefer to
> +        * get sleep in oom path right before kernel panic, and avoid race
> +        * condition.
> +        * Since it is already oom, so there should be not any big allocation
> +        * which could change the statistics significantly.
> +        */
> +       list_for_each_entry_safe(s, s2, &slab_caches, list) {
> +               if (!is_root_cache(s) || (s->flags & SLAB_RECLAIM_ACCOUNT))
> +                       continue;
> +
> +               memset(&sinfo, 0, sizeof(sinfo));
> +               get_slabinfo(s, &sinfo);
> +
> +               if (sinfo.num_objs > 0)
> +                       pr_info("%-17s %10luKB %10luKB\n", cache_name(s),
> +                               (sinfo.active_objs * s->size) / 1024,
> +                               (sinfo.num_objs * s->size) / 1024);
> +       }
> +}
> +

Seems it's a good feature and patch is fine, maybe modify like below is better.

Change
 if (sinfo.num_objs > 0)
to
 if (sinfo.num_objs > 0 && sinfo.actives_objs > 0)

--
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:[~2017-09-24  6:10 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-22 19:52 [PATCH 0/2 v6] oom: capture unreclaimable slab info in oom message " Yang Shi
2017-09-22 19:52 ` [PATCH 1/2] tools: slabinfo: add "-U" option to show unreclaimable slabs only Yang Shi
2017-09-22 19:52 ` [PATCH 2/2] mm: oom: show unreclaimable slab info when kernel panic Yang Shi
2017-09-24  6:10   ` Qixuan Wu [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-09-21 20:52 [PATCH 0/2 v5] oom: capture unreclaimable slab info in oom message " Yang Shi
2017-09-21 20:52 ` [PATCH 2/2] mm: oom: show unreclaimable slab info " Yang Shi
2017-09-20 22:38 [PATCH 0/2 v4] oom: capture unreclaimable slab info in oom message " Yang Shi
2017-09-20 22:38 ` [PATCH 2/2] mm: oom: show unreclaimable slab info " Yang Shi
2017-09-21  8:23   ` David Rientjes
2017-09-21 17:51     ` Yang Shi
2017-09-20 19:09 [RFC v3] oom: capture unreclaimable slab info in oom message " Yang Shi
2017-09-20 19:09 ` [PATCH 2/2] mm: oom: show unreclaimable slab info " Yang Shi
2017-09-20 21:00   ` David Rientjes
2017-09-20 21:32     ` Yang Shi
2017-09-18 18:26 [RFC v2] oom: capture unreclaimable slab info in oom message " Yang Shi
2017-09-18 18:26 ` [PATCH 2/2] mm: oom: show unreclaimable slab info " Yang Shi
2017-09-19 20:57   ` David Rientjes
2017-09-19 21:45     ` Yang Shi
2017-09-19 22:41       ` David Rientjes
2017-09-19 23:03         ` Yang Shi
2017-09-18 18:23 [PATCH 1/2] tools: slabinfo: add "-U" option to show unreclaimable slabs only Yang Shi
2017-09-18 18:23 ` [PATCH 2/2] mm: oom: show unreclaimable slab info when kernel panic Yang Shi

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=CAEjEV8DcOzh+TEeF4MmPTbAEq4ahCCCG3tiU975dhwauv2RgGQ@mail.gmail.com \
    --to=wuqixuan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    --cc=yang.s@alibaba-inc.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