linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Rientjes <rientjes@google.com>
To: Yang Shi <yang.s@alibaba-inc.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: Tue, 19 Sep 2017 13:57:15 -0700 (PDT)	[thread overview]
Message-ID: <alpine.DEB.2.10.1709191356020.7458@chino.kir.corp.google.com> (raw)
In-Reply-To: <1505759209-102539-3-git-send-email-yang.s@alibaba-inc.com>

On Tue, 19 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?

--
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-19 20:57 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 [this message]
2017-09-19 21:45     ` Yang Shi
2017-09-19 22:41       ` David Rientjes
2017-09-19 23:03         ` Yang Shi
  -- 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=alpine.DEB.2.10.1709191356020.7458@chino.kir.corp.google.com \
    --to=rientjes@google.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=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