Re: [PATCH 1/3] mm: memcontrol: make tree_{stat,events} fetch all stats
From: Johannes Weiner
Date: Thu Feb 04 2016 - 15:46:37 EST
On Thu, Feb 04, 2016 at 04:03:37PM +0300, Vladimir Davydov wrote:
> Currently, tree_{stat,events} helpers can only get one stat index at a
> time, so when there are a lot of stats to be reported one has to call it
> over and over again (see memory_stat_show). This is neither effective,
> nor does it look good. Instead, let's make these helpers take a snapshot
> of all available counters.
>
> Signed-off-by: Vladimir Davydov <vdavydov@xxxxxxxxxxxxx>
This looks much better, and most of the callstacks involved here are
very flat, so the increased stack consumption should be alright.
The only exception there is the threshold code, which can happen from
the direct reclaim path and thus with a fairly deep stack already.
Would it be better to leave mem_cgroup_usage() alone, open-code it,
and then use tree_stat() and tree_events() only for v2 memory.stat?