Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1738111
| From | Qixuan Wu <wuqixuan@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 2/2] mm: oom: show unreclaimable slab info when kernel panic |
| Date | 2017-09-24 08:20 +0200 |
| Message-ID | <ut8qK-5bY-5@gated-at.bofh.it> (permalink) |
| References | <usChb-1IF-3@gated-at.bofh.it> <usChb-1IF-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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)
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH 2/2] mm: oom: show unreclaimable slab info when kernel panic "Yang Shi" <yang.s@alibaba-inc.com> - 2017-09-22 22:00 +0200 [PATCH 2/2] mm: oom: show unreclaimable slab info when kernel panic Qixuan Wu <wuqixuan@gmail.com> - 2017-09-24 08:20 +0200
csiph-web