Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1735260

Re: [PATCH 2/2] mm: oom: show unreclaimable slab info when kernel panic

From David Rientjes <rientjes@google.com>
Newsgroups linux.kernel
Subject Re: [PATCH 2/2] mm: oom: show unreclaimable slab info when kernel panic
Date 2017-09-19 23:00 +0200
Message-ID <urxMC-1ME-13@gated-at.bofh.it> (permalink)
References <ur8XV-1sf-11@gated-at.bofh.it> <ur8XV-1sf-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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?

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC v2] oom: capture unreclaimable slab info in oom message when kernel panic "Yang Shi" <yang.s@alibaba-inc.com> - 2017-09-18 20:30 +0200
  [PATCH 2/2] mm: oom: show unreclaimable slab info when kernel panic "Yang Shi" <yang.s@alibaba-inc.com> - 2017-09-18 20:30 +0200
    Re: [PATCH 2/2] mm: oom: show unreclaimable slab info when kernel  panic David Rientjes <rientjes@google.com> - 2017-09-19 23:00 +0200
      Re: [PATCH 2/2] mm: oom: show unreclaimable slab info when kernel  panic "Yang Shi" <yang.s@alibaba-inc.com> - 2017-09-19 23:50 +0200
        Re: [PATCH 2/2] mm: oom: show unreclaimable slab info when kernel  panic David Rientjes <rientjes@google.com> - 2017-09-20 00:50 +0200
          Re: [PATCH 2/2] mm: oom: show unreclaimable slab info when kernel  panic "Yang Shi" <yang.s@alibaba-inc.com> - 2017-09-20 01:10 +0200

csiph-web