From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail6.bemta8.messagelabs.com (mail6.bemta8.messagelabs.com [216.82.243.55]) by kanga.kvack.org (Postfix) with ESMTP id CE45E6B0011 for ; Tue, 24 May 2011 12:54:54 -0400 (EDT) Received: from hpaq14.eem.corp.google.com (hpaq14.eem.corp.google.com [172.25.149.14]) by smtp-out.google.com with ESMTP id p4OGslmo014238 for ; Tue, 24 May 2011 09:54:47 -0700 Received: from qwb8 (qwb8.prod.google.com [10.241.193.72]) by hpaq14.eem.corp.google.com with ESMTP id p4OGrFvC028459 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NOT) for ; Tue, 24 May 2011 09:54:46 -0700 Received: by qwb8 with SMTP id 8so4825237qwb.11 for ; Tue, 24 May 2011 09:54:43 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20110524154644.GA3440@balbir.in.ibm.com> References: <1305928918-15207-1-git-send-email-yinghan@google.com> <20110524154644.GA3440@balbir.in.ibm.com> Date: Tue, 24 May 2011 09:54:43 -0700 Message-ID: Subject: Re: [PATCH V5] memcg: add memory.numastat api for numa statistics From: Ying Han Content-Type: multipart/alternative; boundary=002354470aa8d6acf304a40871fc Sender: owner-linux-mm@kvack.org List-ID: To: balbir@linux.vnet.ibm.com Cc: KOSAKI Motohiro , Minchan Kim , Daisuke Nishimura , Tejun Heo , Pavel Emelyanov , KAMEZAWA Hiroyuki , Andrew Morton , Li Zefan , Mel Gorman , Christoph Lameter , Johannes Weiner , Rik van Riel , Hugh Dickins , Michal Hocko , Dave Hansen , Zhu Yanhai , linux-mm@kvack.org --002354470aa8d6acf304a40871fc Content-Type: text/plain; charset=ISO-8859-1 On Tue, May 24, 2011 at 8:46 AM, Balbir Singh wrote: > * Ying Han [2011-05-20 15:01:58]: > > > The new API exports numa_maps per-memcg basis. This is a piece of useful > > information where it exports per-memcg page distribution across real numa > > nodes. > > > > One of the usecase is evaluating application performance by combining > this > > information w/ the cpu allocation to the application. > > > > The output of the memory.numastat tries to follow w/ simiar format of > numa_maps > > like: > > > > total= N0= N1= ... > > file= N0= N1= ... > > anon= N0= N1= ... > > unevictable= N0= N1= ... > > > > And we have per-node: > > total = file + anon + unevictable > > > > $ cat /dev/cgroup/memory/memory.numa_stat > > total=250020 N0=87620 N1=52367 N2=45298 N3=64735 > > file=225232 N0=83402 N1=46160 N2=40522 N3=55148 > > anon=21053 N0=3424 N1=6207 N2=4776 N3=6646 > > unevictable=3735 N0=794 N1=0 N2=0 N3=2941 > > > > This patch is based on mmotm-2011-05-06-16-39 > > > > change v5..v4: > > 1. disable the API non-NUMA kernel. > > > > change v4..v3: > > 1. add per-node "unevictable" value. > > 2. change the functions to be static. > > > > change v3..v2: > > 1. calculate the "total" based on the per-memcg lru size instead of > rss+cache. > > this makes the "total" value to be consistant w/ the per-node values > follows > > after. > > > > change v2..v1: > > 1. add also the file and anon pages on per-node distribution. > > > > Signed-off-by: Ying Han > > Acked-by: KAMEZAWA Hiroyuki > > Acked-by: Daisuke Nishimura > > --- > > mm/memcontrol.c | 155 > +++++++++++++++++++++++++++++++++++++++++++++++++++++++ > > 1 files changed, 155 insertions(+), 0 deletions(-) > > > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > > index e14677c..ced414b 100644 > > --- a/mm/memcontrol.c > > +++ b/mm/memcontrol.c > > @@ -1162,6 +1162,93 @@ unsigned long mem_cgroup_zone_nr_lru_pages(struct > mem_cgroup *memcg, > > return MEM_CGROUP_ZSTAT(mz, lru); > > } > > > > +#ifdef CONFIG_NUMA > > +static unsigned long mem_cgroup_node_nr_file_lru_pages(struct mem_cgroup > *memcg, > > + int nid) > > +{ > > + unsigned long ret; > > + > > + ret = mem_cgroup_get_zonestat_node(memcg, nid, LRU_INACTIVE_FILE) + > > + mem_cgroup_get_zonestat_node(memcg, nid, LRU_ACTIVE_FILE); > > + > > + return ret; > > +} > > + > > +static unsigned long mem_cgroup_nr_file_lru_pages(struct mem_cgroup > *memcg) > > +{ > > + u64 total = 0; > > + int nid; > > + > > + for_each_node_state(nid, N_HIGH_MEMORY) > > + total += mem_cgroup_node_nr_file_lru_pages(memcg, nid); > > + > > + return total; > > +} > > + > > +static unsigned long mem_cgroup_node_nr_anon_lru_pages(struct mem_cgroup > *memcg, > > + int nid) > > +{ > > + unsigned long ret; > > + > > + ret = mem_cgroup_get_zonestat_node(memcg, nid, LRU_INACTIVE_ANON) + > > + mem_cgroup_get_zonestat_node(memcg, nid, LRU_ACTIVE_ANON); > > + > > + return ret; > > +} > > + > > +static unsigned long mem_cgroup_nr_anon_lru_pages(struct mem_cgroup > *memcg) > > +{ > > + u64 total = 0; > > + int nid; > > + > > + for_each_node_state(nid, N_HIGH_MEMORY) > > + total += mem_cgroup_node_nr_anon_lru_pages(memcg, nid); > > + > > + return total; > > +} > > + > > +static unsigned long > > +mem_cgroup_node_nr_unevictable_lru_pages(struct mem_cgroup *memcg, int > nid) > > +{ > > + return mem_cgroup_get_zonestat_node(memcg, nid, LRU_UNEVICTABLE); > > +} > > + > > +static unsigned long > > +mem_cgroup_nr_unevictable_lru_pages(struct mem_cgroup *memcg) > > +{ > > + u64 total = 0; > > + int nid; > > + > > + for_each_node_state(nid, N_HIGH_MEMORY) > > + total += mem_cgroup_node_nr_unevictable_lru_pages(memcg, > nid); > > + > > + return total; > > +} > > + > > +static unsigned long mem_cgroup_node_nr_lru_pages(struct mem_cgroup > *memcg, > > + int nid) > > +{ > > + enum lru_list l; > > + u64 total = 0; > > + > > + for_each_lru(l) > > + total += mem_cgroup_get_zonestat_node(memcg, nid, l); > > + > > + return total; > > +} > > + > > +static unsigned long mem_cgroup_nr_lru_pages(struct mem_cgroup *memcg) > > +{ > > + u64 total = 0; > > + int nid; > > + > > + for_each_node_state(nid, N_HIGH_MEMORY) > > + total += mem_cgroup_node_nr_lru_pages(memcg, nid); > > + > > + return total; > > +} > > +#endif /* CONFIG_NUMA */ > > + > > struct zone_reclaim_stat *mem_cgroup_get_reclaim_stat(struct mem_cgroup > *memcg, > > struct zone *zone) > > { > > @@ -4048,6 +4135,51 @@ mem_cgroup_get_total_stat(struct mem_cgroup *mem, > struct mcs_total_stat *s) > > mem_cgroup_get_local_stat(iter, s); > > } > > > > +#ifdef CONFIG_NUMA > > +static int mem_control_numa_stat_show(struct seq_file *m, void *arg) > > +{ > > + int nid; > > + unsigned long total_nr, file_nr, anon_nr, unevictable_nr; > > + unsigned long node_nr; > > + struct cgroup *cont = m->private; > > + struct mem_cgroup *mem_cont = mem_cgroup_from_cont(cont); > > + > > + total_nr = mem_cgroup_nr_lru_pages(mem_cont); > > + seq_printf(m, "total=%lu", total_nr); > > + for_each_node_state(nid, N_HIGH_MEMORY) { > > + node_nr = mem_cgroup_node_nr_lru_pages(mem_cont, nid); > > + seq_printf(m, " N%d=%lu", nid, node_nr); > > + } > > + seq_putc(m, '\n'); > > + > > + file_nr = mem_cgroup_nr_file_lru_pages(mem_cont); > > + seq_printf(m, "file=%lu", file_nr); > > + for_each_node_state(nid, N_HIGH_MEMORY) { > > + node_nr = mem_cgroup_node_nr_file_lru_pages(mem_cont, nid); > > + seq_printf(m, " N%d=%lu", nid, node_nr); > > + } > > + seq_putc(m, '\n'); > > + > > + anon_nr = mem_cgroup_nr_anon_lru_pages(mem_cont); > > + seq_printf(m, "anon=%lu", anon_nr); > > + for_each_node_state(nid, N_HIGH_MEMORY) { > > + node_nr = mem_cgroup_node_nr_anon_lru_pages(mem_cont, nid); > > + seq_printf(m, " N%d=%lu", nid, node_nr); > > + } > > + seq_putc(m, '\n'); > > + > > + unevictable_nr = mem_cgroup_nr_unevictable_lru_pages(mem_cont); > > + seq_printf(m, "unevictable=%lu", unevictable_nr); > > + for_each_node_state(nid, N_HIGH_MEMORY) { > > + node_nr = > mem_cgroup_node_nr_unevictable_lru_pages(mem_cont, > > + > nid); > > + seq_printf(m, " N%d=%lu", nid, node_nr); > > + } > > + seq_putc(m, '\n'); > > + return 0; > > +} > > +#endif /* CONFIG_NUMA */ > > + > > static int mem_control_stat_show(struct cgroup *cont, struct cftype > *cft, > > struct cgroup_map_cb *cb) > > { > > @@ -4058,6 +4190,7 @@ static int mem_control_stat_show(struct cgroup > *cont, struct cftype *cft, > > memset(&mystat, 0, sizeof(mystat)); > > mem_cgroup_get_local_stat(mem_cont, &mystat); > > > > + > > for (i = 0; i < NR_MCS_STAT; i++) { > > if (i == MCS_SWAP && !do_swap_account) > > continue; > > @@ -4481,6 +4614,22 @@ static int mem_cgroup_oom_control_write(struct > cgroup *cgrp, > > return 0; > > } > > > > +#ifdef CONFIG_NUMA > > +static const struct file_operations > mem_control_numa_stat_file_operations = { > > + .read = seq_read, > > + .llseek = seq_lseek, > > + .release = single_release, > > +}; > > + > > Do we need this? > > > > +static int mem_control_numa_stat_open(struct inode *unused, struct file > *file) > > +{ > > + struct cgroup *cont = file->f_dentry->d_parent->d_fsdata; > > + > > + file->f_op = &mem_control_numa_stat_file_operations; > > + return single_open(file, mem_control_numa_stat_show, cont); > > +} > > +#endif /* CONFIG_NUMA */ > > + > > static struct cftype mem_cgroup_files[] = { > > { > > .name = "usage_in_bytes", > > @@ -4544,6 +4693,12 @@ static struct cftype mem_cgroup_files[] = { > > .unregister_event = mem_cgroup_oom_unregister_event, > > .private = MEMFILE_PRIVATE(_OOM_TYPE, OOM_CONTROL), > > }, > > +#ifdef CONFIG_NUMA > > + { > > + .name = "numa_stat", > > + .open = mem_control_numa_stat_open, > > + }, > > +#endif > > Can't we do this the way we do the stats file? Please see > mem_control_stat_show(). > I looked that earlier but can not get the formating working as well as the seq_*. Is there a particular reason we prefer one than the other? Thanks --Ying > > > }; > > > > #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP > > -- > > 1.7.3.1 > > > > -- > Three Cheers, > Balbir > > -- > 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/ . > Fight unfair telecom internet charges in Canada: sign > http://stopthemeter.ca/ > Don't email: email@kvack.org > --002354470aa8d6acf304a40871fc Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

On Tue, May 24, 2011 at 8:46 AM, Balbir = Singh <ba= lbir@linux.vnet.ibm.com> wrote:
* Ying Han <yinghan@google.com= > [2011-05-20 15:01:58]:

> The new API exports numa_maps per-memcg basis. This is a piece of usef= ul
> information where it exports per-memcg page distribution across real n= uma
> nodes.
>
> One of the usecase is evaluating application performance by combining = this
> information w/ the cpu allocation to the application.
>
> The output of the memory.numastat tries to follow w/ simiar format of = numa_maps
> like:
>
> total=3D<total pages> N0=3D<node 0 pages> N1=3D<node 1 = pages> ...
> file=3D<total file pages> N0=3D<node 0 pages> N1=3D<nod= e 1 pages> ...
> anon=3D<total anon pages> N0=3D<node 0 pages> N1=3D<nod= e 1 pages> ...
> unevictable=3D<total anon pages> N0=3D<node 0 pages> N1=3D= <node 1 pages> ...
>
> And we have per-node:
> total =3D file + anon + unevictable
>
> $ cat /dev/cgroup/memory/memory.numa_stat
> total=3D250020 N0=3D87620 N1=3D52367 N2=3D45298 N3=3D64735
> file=3D225232 N0=3D83402 N1=3D46160 N2=3D40522 N3=3D55148
> anon=3D21053 N0=3D3424 N1=3D6207 N2=3D4776 N3=3D6646
> unevictable=3D3735 N0=3D794 N1=3D0 N2=3D0 N3=3D2941
>
> This patch is based on mmotm-2011-05-06-16-39
>
> change v5..v4:
> 1. disable the API non-NUMA kernel.
>
> change v4..v3:
> 1. add per-node "unevictable" value.
> 2. change the functions to be static.
>
> change v3..v2:
> 1. calculate the "total" based on the per-memcg lru size ins= tead of rss+cache.
> this makes the "total" value to be consistant w/ the per-nod= e values follows
> after.
>
> change v2..v1:
> 1. add also the file and anon pages on per-node distribution.
>
> Signed-off-by: Ying Han <ying= han@google.com>
> Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> Acked-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
> ---
> =A0mm/memcontrol.c | =A0155 ++++++++++++++++++++++++++++++++++++++++++= +++++++++++++
> =A01 files changed, 155 insertions(+), 0 deletions(-)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index e14677c..ced414b 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -1162,6 +1162,93 @@ unsigned long mem_cgroup_zone_nr_lru_pages(stru= ct mem_cgroup *memcg,
> =A0 =A0 =A0 return MEM_CGROUP_ZSTAT(mz, lru);
> =A0}
>
> +#ifdef CONFIG_NUMA
> +static unsigned long mem_cgroup_node_nr_file_lru_pages(struct mem_cgr= oup *memcg,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 int nid)
> +{
> + =A0 =A0 unsigned long ret;
> +
> + =A0 =A0 ret =3D mem_cgroup_get_zonestat_node(memcg, nid, LRU_INACTIV= E_FILE) +
> + =A0 =A0 =A0 =A0 =A0 =A0 mem_cgroup_get_zonestat_node(memcg, nid, LRU= _ACTIVE_FILE);
> +
> + =A0 =A0 return ret;
> +}
> +
> +static unsigned long mem_cgroup_nr_file_lru_pages(struct mem_cgroup *= memcg)
> +{
> + =A0 =A0 u64 total =3D 0;
> + =A0 =A0 int nid;
> +
> + =A0 =A0 for_each_node_state(nid, N_HIGH_MEMORY)
> + =A0 =A0 =A0 =A0 =A0 =A0 total +=3D mem_cgroup_node_nr_file_lru_pages= (memcg, nid);
> +
> + =A0 =A0 return total;
> +}
> +
> +static unsigned long mem_cgroup_node_nr_anon_lru_pages(struct mem_cgr= oup *memcg,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 int nid)
> +{
> + =A0 =A0 unsigned long ret;
> +
> + =A0 =A0 ret =3D mem_cgroup_get_zonestat_node(memcg, nid, LRU_INACTIV= E_ANON) +
> + =A0 =A0 =A0 =A0 =A0 =A0 mem_cgroup_get_zonestat_node(memcg, nid, LRU= _ACTIVE_ANON);
> +
> + =A0 =A0 return ret;
> +}
> +
> +static unsigned long mem_cgroup_nr_anon_lru_pages(struct mem_cgroup *= memcg)
> +{
> + =A0 =A0 u64 total =3D 0;
> + =A0 =A0 int nid;
> +
> + =A0 =A0 for_each_node_state(nid, N_HIGH_MEMORY)
> + =A0 =A0 =A0 =A0 =A0 =A0 total +=3D mem_cgroup_node_nr_anon_lru_pages= (memcg, nid);
> +
> + =A0 =A0 return total;
> +}
> +
> +static unsigned long
> +mem_cgroup_node_nr_unevictable_lru_pages(struct mem_cgroup *memcg, in= t nid)
> +{
> + =A0 =A0 return mem_cgroup_get_zonestat_node(memcg, nid, LRU_UNEVICTA= BLE);
> +}
> +
> +static unsigned long
> +mem_cgroup_nr_unevictable_lru_pages(struct mem_cgroup *memcg)
> +{
> + =A0 =A0 u64 total =3D 0;
> + =A0 =A0 int nid;
> +
> + =A0 =A0 for_each_node_state(nid, N_HIGH_MEMORY)
> + =A0 =A0 =A0 =A0 =A0 =A0 total +=3D mem_cgroup_node_nr_unevictable_lr= u_pages(memcg, nid);
> +
> + =A0 =A0 return total;
> +}
> +
> +static unsigned long mem_cgroup_node_nr_lru_pages(struct mem_cgroup *= memcg,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 int nid)
> +{
> + =A0 =A0 enum lru_list l;
> + =A0 =A0 u64 total =3D 0;
> +
> + =A0 =A0 for_each_lru(l)
> + =A0 =A0 =A0 =A0 =A0 =A0 total +=3D mem_cgroup_get_zonestat_node(memc= g, nid, l);
> +
> + =A0 =A0 return total;
> +}
> +
> +static unsigned long mem_cgroup_nr_lru_pages(struct mem_cgroup *memcg= )
> +{
> + =A0 =A0 u64 total =3D 0;
> + =A0 =A0 int nid;
> +
> + =A0 =A0 for_each_node_state(nid, N_HIGH_MEMORY)
> + =A0 =A0 =A0 =A0 =A0 =A0 total +=3D mem_cgroup_node_nr_lru_pages(memc= g, nid);
> +
> + =A0 =A0 return total;
> +}
> +#endif /* CONFIG_NUMA */
> +
> =A0struct zone_reclaim_stat *mem_cgroup_get_reclaim_stat(struct mem_cg= roup *memcg,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 struct zone *zone)
> =A0{
> @@ -4048,6 +4135,51 @@ mem_cgroup_get_total_stat(struct mem_cgroup *me= m, struct mcs_total_stat *s)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 mem_cgroup_get_local_stat(iter, s);
> =A0}
>
> +#ifdef CONFIG_NUMA
> +static int mem_control_numa_stat_show(struct seq_file *m, void *arg)<= br> > +{
> + =A0 =A0 int nid;
> + =A0 =A0 unsigned long total_nr, file_nr, anon_nr, unevictable_nr; > + =A0 =A0 unsigned long node_nr;
> + =A0 =A0 struct cgroup *cont =3D m->private;
> + =A0 =A0 struct mem_cgroup *mem_cont =3D mem_cgroup_from_cont(cont);<= br> > +
> + =A0 =A0 total_nr =3D mem_cgroup_nr_lru_pages(mem_cont);
> + =A0 =A0 seq_printf(m, "total=3D%lu", total_nr);
> + =A0 =A0 for_each_node_state(nid, N_HIGH_MEMORY) {
> + =A0 =A0 =A0 =A0 =A0 =A0 node_nr =3D mem_cgroup_node_nr_lru_pages(mem= _cont, nid);
> + =A0 =A0 =A0 =A0 =A0 =A0 seq_printf(m, " N%d=3D%lu", nid, n= ode_nr);
> + =A0 =A0 }
> + =A0 =A0 seq_putc(m, '\n');
> +
> + =A0 =A0 file_nr =3D mem_cgroup_nr_file_lru_pages(mem_cont);
> + =A0 =A0 seq_printf(m, "file=3D%lu", file_nr);
> + =A0 =A0 for_each_node_state(nid, N_HIGH_MEMORY) {
> + =A0 =A0 =A0 =A0 =A0 =A0 node_nr =3D mem_cgroup_node_nr_file_lru_page= s(mem_cont, nid);
> + =A0 =A0 =A0 =A0 =A0 =A0 seq_printf(m, " N%d=3D%lu", nid, n= ode_nr);
> + =A0 =A0 }
> + =A0 =A0 seq_putc(m, '\n');
> +
> + =A0 =A0 anon_nr =3D mem_cgroup_nr_anon_lru_pages(mem_cont);
> + =A0 =A0 seq_printf(m, "anon=3D%lu", anon_nr);
> + =A0 =A0 for_each_node_state(nid, N_HIGH_MEMORY) {
> + =A0 =A0 =A0 =A0 =A0 =A0 node_nr =3D mem_cgroup_node_nr_anon_lru_page= s(mem_cont, nid);
> + =A0 =A0 =A0 =A0 =A0 =A0 seq_printf(m, " N%d=3D%lu", nid, n= ode_nr);
> + =A0 =A0 }
> + =A0 =A0 seq_putc(m, '\n');
> +
> + =A0 =A0 unevictable_nr =3D mem_cgroup_nr_unevictable_lru_pages(mem_c= ont);
> + =A0 =A0 seq_printf(m, "unevictable=3D%lu", unevictable_nr)= ;
> + =A0 =A0 for_each_node_state(nid, N_HIGH_MEMORY) {
> + =A0 =A0 =A0 =A0 =A0 =A0 node_nr =3D mem_cgroup_node_nr_unevictable_l= ru_pages(mem_cont,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 nid); > + =A0 =A0 =A0 =A0 =A0 =A0 seq_printf(m, " N%d=3D%lu", nid, n= ode_nr);
> + =A0 =A0 }
> + =A0 =A0 seq_putc(m, '\n');
> + =A0 =A0 return 0;
> +}
> +#endif /* CONFIG_NUMA */
> +
> =A0static int mem_control_stat_show(struct cgroup *cont, struct cftype= *cft,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0struct = cgroup_map_cb *cb)
> =A0{
> @@ -4058,6 +4190,7 @@ static int mem_control_stat_show(struct cgroup *= cont, struct cftype *cft,
> =A0 =A0 =A0 memset(&mystat, 0, sizeof(mystat));
> =A0 =A0 =A0 mem_cgroup_get_local_stat(mem_cont, &mystat);
>
> +
> =A0 =A0 =A0 for (i =3D 0; i < NR_MCS_STAT; i++) {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (i =3D=3D MCS_SWAP && !do_swap_= account)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 continue;
> @@ -4481,6 +4614,22 @@ static int mem_cgroup_oom_control_write(struct = cgroup *cgrp,
> =A0 =A0 =A0 return 0;
> =A0}
>
> +#ifdef CONFIG_NUMA
> +static const struct file_operations mem_control_numa_stat_file_operat= ions =3D {
> + =A0 =A0 .read =3D seq_read,
> + =A0 =A0 .llseek =3D seq_lseek,
> + =A0 =A0 .release =3D single_release,
> +};
> +

Do we need this?


> +static int mem_control_numa_stat_open(struct inode *unused, struct fi= le *file)
> +{
> + =A0 =A0 struct cgroup *cont =3D file->f_dentry->d_parent->d= _fsdata;
> +
> + =A0 =A0 file->f_op =3D &mem_control_numa_stat_file_operations= ;
> + =A0 =A0 return single_open(file, mem_control_numa_stat_show, cont);<= br> > +}
> +#endif /* CONFIG_NUMA */
> +
> =A0static struct cftype mem_cgroup_files[] =3D {
> =A0 =A0 =A0 {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 .name =3D "usage_in_bytes",
> @@ -4544,6 +4693,12 @@ static struct cftype mem_cgroup_files[] =3D { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 .unregister_event =3D mem_cgroup_oom_unreg= ister_event,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 .private =3D MEMFILE_PRIVATE(_OOM_TYPE, OO= M_CONTROL),
> =A0 =A0 =A0 },
> +#ifdef CONFIG_NUMA
> + =A0 =A0 {
> + =A0 =A0 =A0 =A0 =A0 =A0 .name =3D "numa_stat",
> + =A0 =A0 =A0 =A0 =A0 =A0 .open =3D mem_control_numa_stat_open,
> + =A0 =A0 },
> +#endif

Can't we do this the way we do the stats file? Please see
mem_control_stat_show().

I looked that = earlier but can not get the formating working as well as the seq_*. Is ther= e a particular reason we prefer one than the other?

Thanks=A0
--Ying
=A0

> =A0};
>
> =A0#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
> --
> 1.7.3.1
>

--
=A0 =A0 =A0 =A0Three Cheers,
=A0 =A0 =A0 =A0Balbir

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.= =A0For more info on Linux MM,
see: http://www.linu= x-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=3Dmailto:"dont@kvack.org"> email@kva= ck.org </a>

--002354470aa8d6acf304a40871fc-- -- 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/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: email@kvack.org