From: "Yang Shi" <yang.s@alibaba-inc.com>
To: David Rientjes <rientjes@google.com>
Cc: cl@linux.com, penberg@kernel.org, iamjoonsoo.kim@lge.com,
akpm@linux-foundation.org, mhocko@kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] mm: oom: show unreclaimable slab info when kernel panic
Date: Wed, 20 Sep 2017 07:03:14 +0800 [thread overview]
Message-ID: <11acb4bd-a1bf-cc32-a124-d98bf746f201@alibaba-inc.com> (raw)
In-Reply-To: <alpine.DEB.2.10.1709191539010.137005@chino.kir.corp.google.com>
On 9/19/17 3:41 PM, David Rientjes wrote:
> On Wed, 20 Sep 2017, Yang Shi wrote:
>
>>>> --- a/mm/slab_common.c
>>>> +++ b/mm/slab_common.c
>>>> @@ -35,6 +35,8 @@
>>>> static DECLARE_WORK(slab_caches_to_rcu_destroy_work,
>>>> slab_caches_to_rcu_destroy_workfn);
>>>> +#define K(x) ((x)/1024)
>>>> +
>>>> /*
>>>> * Set of flags that will prevent slab merging
>>>> */
>>>> @@ -1272,6 +1274,34 @@ static int slab_show(struct seq_file *m, void *p)
>>>> return 0;
>>>> }
>>>> +void show_unreclaimable_slab()
>>>> +{
>>>> + struct kmem_cache *s = NULL;
>>>> + struct slabinfo sinfo;
>>>> +
>>>> + memset(&sinfo, 0, sizeof(sinfo));
>>>> +
>>>> + printk("Unreclaimable slabs:\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(s, &slab_caches, list) {
>>>> + if (!is_root_cache(s))
>>>> + continue;
>>>> +
>>>> + get_slabinfo(s, &sinfo);
>>>> +
>>>> + if (!is_reclaimable(s) && sinfo.num_objs > 0)
>>>> + printk("%-17s %luKB\n", cache_name(s),
>>>> K(sinfo.num_objs * s->size));
>>>> + }
>>>
>>> I like this, but could we be even more helpful by giving the user more
>>> information from sinfo beyond just the total size of objects allocated?
>>
>> Sure, we definitely can. But, the question is what info is helpful to users to
>> diagnose oom other than the size.
>>
>> I think of the below:
>> - the number of active objs, the number of total objs, the percentage
>> of active objs per cache
>> - the number of active slabs, the number of total slabs, the
>> percentage of active slabs per cache
>>
>> Anything else?
>>
>
> Right now it's a useful tool to find out what unreclaimable slab is
> sitting around that is causing the system to run out of memory. If we
> knew how much of this slab is actually in use vs free, it can determine if
> its stranding or if there's a bug in the slab allocator itself.
I see. You prefer to have a report which looks like:
Cache Used size Free size
mm_struct 100K 50K
Or show the total size (used + free) instead of free size. And, may plus
the number of objs and the number of total objs.
Thanks,
Yang
>
> We wouldn't need percentages, we can calculate that directly from the
> data if necessary.
>
--
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>
next prev parent reply other threads:[~2017-09-19 23:03 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-18 18:26 [RFC v2] oom: capture unreclaimable slab info in oom message " Yang Shi
2017-09-18 18:26 ` [PATCH 1/2] tools: slabinfo: add "-U" option to show unreclaimable slabs only Yang Shi
2017-09-18 18:26 ` [PATCH 2/2] mm: oom: show unreclaimable slab info when kernel panic 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 [this message]
-- strict thread matches above, loose matches on Subject: below --
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 2/2] mm: oom: show unreclaimable slab info " Yang Shi
2017-09-24 6:10 ` Qixuan Wu
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: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=11acb4bd-a1bf-cc32-a124-d98bf746f201@alibaba-inc.com \
--to=yang.s@alibaba-inc.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 \
/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