linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@suse.cz>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	cgroups@vger.kernel.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [patch 2/6] mm: memcg: convert numa stat to read_seq_string interface
Date: Tue, 15 May 2012 16:43:05 +0200	[thread overview]
Message-ID: <20120515144305.GG11346@tiehlicka.suse.cz> (raw)
In-Reply-To: <1337018451-27359-3-git-send-email-hannes@cmpxchg.org>

On Mon 14-05-12 20:00:47, Johannes Weiner wrote:
> Instead of using the raw seq_file file interface, switch over to the
> read_seq_string cftype callback and let cgroup core code set up the
> seq_file.
> 
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>

Acked-by: Michal Hocko <mhocko@suse.cz>

> ---
>  mm/memcontrol.c |   23 +++--------------------
>  1 file changed, 3 insertions(+), 20 deletions(-)
> 
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index aef89c1..f0d248b 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -4345,12 +4345,12 @@ mem_cgroup_get_total_stat(struct mem_cgroup *memcg, struct mcs_total_stat *s)
>  }
>  
>  #ifdef CONFIG_NUMA
> -static int mem_control_numa_stat_show(struct seq_file *m, void *arg)
> +static int mem_control_numa_stat_show(struct cgroup *cont, struct cftype *cft,
> +				      struct seq_file *m)
>  {
>  	int nid;
>  	unsigned long total_nr, file_nr, anon_nr, unevictable_nr;
>  	unsigned long node_nr;
> -	struct cgroup *cont = m->private;
>  	struct mem_cgroup *memcg = mem_cgroup_from_cont(cont);
>  
>  	total_nr = mem_cgroup_nr_lru_pages(memcg, LRU_ALL);
> @@ -4825,22 +4825,6 @@ 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,
> -};
> -
> -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 */
> -
>  #ifdef CONFIG_CGROUP_MEM_RES_CTLR_KMEM
>  static int memcg_init_kmem(struct mem_cgroup *memcg, struct cgroup_subsys *ss)
>  {
> @@ -4928,8 +4912,7 @@ static struct cftype mem_cgroup_files[] = {
>  #ifdef CONFIG_NUMA
>  	{
>  		.name = "numa_stat",
> -		.open = mem_control_numa_stat_open,
> -		.mode = S_IRUGO,
> +		.read_seq_string = mem_control_numa_stat_show,
>  	},
>  #endif
>  #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
> -- 
> 1.7.10.1
> 

-- 
Michal Hocko
SUSE Labs
SUSE LINUX s.r.o.
Lihovarska 1060/12
190 00 Praha 9    
Czech Republic

--
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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2012-05-15 14:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-14 18:00 [patch 0/6] mm: memcg: statistics implementation cleanups Johannes Weiner
2012-05-14 18:00 ` [patch 1/6] mm: memcg: remove obsolete statistics array boundary enum item Johannes Weiner
2012-05-15 14:14   ` Michal Hocko
2012-05-14 18:00 ` [patch 2/6] mm: memcg: convert numa stat to read_seq_string interface Johannes Weiner
2012-05-15 14:43   ` Michal Hocko [this message]
2012-05-14 18:00 ` [patch 3/6] mm: memcg: print statistics directly to seq_file Johannes Weiner
2012-05-15 14:46   ` Michal Hocko
2012-05-14 18:00 ` [patch 4/6] mm: memcg: keep ratelimit counter separate from event counters Johannes Weiner
2012-05-15 14:58   ` Michal Hocko
2012-05-14 18:00 ` [patch 5/6] mm: memcg: group swapped-out statistics counter logically Johannes Weiner
2012-05-15 15:04   ` Michal Hocko
2012-05-14 18:00 ` [patch 6/6] mm: memcg: print statistics from live counters Johannes Weiner
2012-05-15 15:27   ` Michal Hocko
2012-05-16 23:01   ` Andrew Morton
2012-05-17  0:01     ` KAMEZAWA Hiroyuki
2012-05-17 10:56       ` Glauber Costa
2012-05-15  0:19 ` [patch 0/6] mm: memcg: statistics implementation cleanups KAMEZAWA Hiroyuki
2012-05-15 11:03   ` Johannes Weiner
2012-05-16  0:01     ` KAMEZAWA Hiroyuki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120515144305.GG11346@tiehlicka.suse.cz \
    --to=mhocko@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox