lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Sun, 24 Sep 2017 14:10:46 +0800
From:   Qixuan Wu <wuqixuan@...il.com>
To:     Yang Shi <yang.s@...baba-inc.com>
Cc:     "cl@...ux.com" <cl@...ux.com>,
        "penberg@...nel.org" <penberg@...nel.org>,
        "rientjes@...gle.com" <rientjes@...gle.com>,
        "iamjoonsoo.kim@....com" <iamjoonsoo.kim@....com>,
        "akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
        "mhocko@...nel.org" <mhocko@...nel.org>,
        "linux-mm@...ck.org" <linux-mm@...ck.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [PATCH 2/2] mm: oom: show unreclaimable slab info when kernel panic

On Sat, Sep 23, 2017, Yang Shi <yang.s@...baba-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)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ