Re: [PATCH 3/3] mm: oom: show unreclaimable slab info when unreclaimable slabs > user memory

From: Michal Hocko
Date: Thu Oct 05 2017 - 05:13:55 EST


On Thu 05-10-17 02:08:48, Yang Shi wrote:
>
>
> On 10/4/17 7:27 AM, Michal Hocko wrote:
> > On Wed 04-10-17 02:06:17, Yang Shi wrote:
> > > +static bool is_dump_unreclaim_slabs(void)
> > > +{
> > > + unsigned long nr_lru;
> > > +
> > > + nr_lru = global_node_page_state(NR_ACTIVE_ANON) +
> > > + global_node_page_state(NR_INACTIVE_ANON) +
> > > + global_node_page_state(NR_ACTIVE_FILE) +
> > > + global_node_page_state(NR_INACTIVE_FILE) +
> > > + global_node_page_state(NR_ISOLATED_ANON) +
> > > + global_node_page_state(NR_ISOLATED_FILE) +
> > > + global_node_page_state(NR_UNEVICTABLE);
> > > +
> > > + return (global_node_page_state(NR_SLAB_UNRECLAIMABLE) > nr_lru);
> > > +}
> >
> > I am sorry I haven't pointed this earlier (I was following only half
> > way) but this should really be memcg aware. You are checking only global
> > counters. I do not think it is an absolute must to provide per-memcg
> > data but you should at least check !is_memcg_oom(oc).
>
> BTW, I saw there is already such check in dump_header that looks like the
> below code:
>
> if (oc->memcg)
> mem_cgroup_print_oom_info(oc->memcg, p);
> else
> show_mem(SHOW_MEM_FILTER_NODES, oc->nodemask);
>
> I'm supposed it'd better to replace "oc->memcg" to "is_memcg_oom(oc)" since
> they do the same check and "is_memcg_oom" interface sounds preferable.

Yes, is_memcg_oom is better

> Then I'm going to move unreclaimable slabs dump to the "else" block.

makes sense.
--
Michal Hocko
SUSE Labs