Re: [PATCH][-mm] memcg : memory cgroup cpu hotplug support update.

From: KAMEZAWA Hiroyuki
Date: Thu Sep 16 2010 - 02:27:15 EST


On Thu, 16 Sep 2010 11:51:59 +0530
Balbir Singh <balbir@xxxxxxxxxxxxxxxxxx> wrote:

> * KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> [2010-09-16 14:46:18]:
>
> > This is onto The mm-of-the-moment snapshot 2010-09-15-16-21.
> >
> > ==
> > From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx>
> >
> > Now, memory cgroup uses for_each_possible_cpu() for percpu stat handling.
> > It's just because cpu hotplug handler doesn't handle them.
> > On the other hand, per-cpu usage counter cache is maintained per cpu and
> > it's cpu hotplug aware.
> >
> > This patch adds a cpu hotplug hanlder and replaces for_each_possible_cpu()
> > with for_each_online_cpu(). And this merges new callbacks with old
> > callbacks.(IOW, memcg has only one cpu-hotplug handler.)
> >
>
> Thanks for accepting my suggestion on get_online_cpus() and for
> working on these patches, this is the right way forward
>
I just like step-by-step patches.


> > For this purpose, mem_cgroup_walk_all() is added.
> >
> > Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx>
> > ---
> > mm/memcontrol.c | 118 ++++++++++++++++++++++++++++++++++++++++++++++----------
> > 1 file changed, 98 insertions(+), 20 deletions(-)
> >
> > Index: mmotm-0915/mm/memcontrol.c
> > ===================================================================
> > --- mmotm-0915.orig/mm/memcontrol.c
> > +++ mmotm-0915/mm/memcontrol.c
> > @@ -89,7 +89,10 @@ enum mem_cgroup_stat_index {
> > MEM_CGROUP_STAT_PGPGIN_COUNT, /* # of pages paged in */
> > MEM_CGROUP_STAT_PGPGOUT_COUNT, /* # of pages paged out */
> > MEM_CGROUP_STAT_SWAPOUT, /* # of pages, swapped out */
> > - MEM_CGROUP_EVENTS, /* incremented at every pagein/pageout */
> > + MEM_CGROUP_STAT_DATA, /* stat above this is for statistics */
> > +
> > + MEM_CGROUP_EVENTS = MEM_CGROUP_STAT_DATA,
> > + /* incremented at every pagein/pageout */
> > MEM_CGROUP_ON_MOVE, /* someone is moving account between groups */
> >
> > MEM_CGROUP_STAT_NSTATS,
> > @@ -537,7 +540,7 @@ static s64 mem_cgroup_read_stat(struct m
> > int cpu;
> > s64 val = 0;
> >
> > - for_each_possible_cpu(cpu)
> > + for_each_online_cpu(cpu)
> > val += per_cpu(mem->stat->count[idx], cpu);
> > return val;
> > }
> > @@ -700,6 +703,35 @@ static inline bool mem_cgroup_is_root(st
> > return (mem == root_mem_cgroup);
> > }
> >
> > +static int mem_cgroup_walk_all(void *data,
> > + int (*func)(struct mem_cgroup *, void *))
>
> Can we call this for_each_mem_cgroup()?
>

This naming is from mem_cgroup_walk_tree(). Now we have

mem_cgroup_walk_tree();
mem_cgroup_walk_all();

Rename both ? But it should be in separated patch.

Thanks,
-Kame

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/