All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@suse.cz>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"nishimura@mxp.nes.nec.co.jp" <nishimura@mxp.nes.nec.co.jp>,
	"bsingharora@gmail.com" <bsingharora@gmail.com>,
	Ying Han <yinghan@google.com>
Subject: Re: [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v2
Date: Thu, 30 Jun 2011 09:33:00 +0200	[thread overview]
Message-ID: <20110630073300.GA13560@tiehlicka.suse.cz> (raw)
In-Reply-To: <20110630161039.604f91b9.kamezawa.hiroyu@jp.fujitsu.com>

On Thu 30-06-11 16:10:39, KAMEZAWA Hiroyuki wrote:
> On Thu, 30 Jun 2011 08:32:32 +0200
> Michal Hocko <mhocko@suse.cz> wrote:
> 
> > On Thu 30-06-11 12:32:29, KAMEZAWA Hiroyuki wrote:
> > [...]
> > > @@ -4288,7 +4287,7 @@ static u64 mem_cgroup_swappiness_read(struct cgroup *cgrp, struct cftype *cft)
> > >  {
> > >  	struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp);
> > >  
> > > -	return get_swappiness(memcg);
> > > +	return mem_cgroup_swappiness(memcg);
> > >  }
> > 
> > If you want to be type clean you should change this one as well. I
> > think it is worth it, though. The function is called only to return the
> > current value to userspace and mem_cgroup_swappiness_write guaranties
> > that it falls down into <0,100> interval. Additionally, cftype doesn't
> > have any read specialization for int values so you would need to use a
> > generic one. Finally if you changed read part you should change also
> > write part and add > 0 check which is a lot of code for not that good
> > reason.
> 
> I don't want to make this type-clean. 

Agreed.

> Should I add type casting as
> ==
>  return (u64) mem_cgroup_swappiness(memcg);
> ==
> ?

I do not think it is necessary. The value is promoted to u64
automatically.

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

WARNING: multiple messages have this Message-ID (diff)
From: Michal Hocko <mhocko@suse.cz>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"nishimura@mxp.nes.nec.co.jp" <nishimura@mxp.nes.nec.co.jp>,
	"bsingharora@gmail.com" <bsingharora@gmail.com>,
	Ying Han <yinghan@google.com>
Subject: Re: [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v2
Date: Thu, 30 Jun 2011 09:33:00 +0200	[thread overview]
Message-ID: <20110630073300.GA13560@tiehlicka.suse.cz> (raw)
In-Reply-To: <20110630161039.604f91b9.kamezawa.hiroyu@jp.fujitsu.com>

On Thu 30-06-11 16:10:39, KAMEZAWA Hiroyuki wrote:
> On Thu, 30 Jun 2011 08:32:32 +0200
> Michal Hocko <mhocko@suse.cz> wrote:
> 
> > On Thu 30-06-11 12:32:29, KAMEZAWA Hiroyuki wrote:
> > [...]
> > > @@ -4288,7 +4287,7 @@ static u64 mem_cgroup_swappiness_read(struct cgroup *cgrp, struct cftype *cft)
> > >  {
> > >  	struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp);
> > >  
> > > -	return get_swappiness(memcg);
> > > +	return mem_cgroup_swappiness(memcg);
> > >  }
> > 
> > If you want to be type clean you should change this one as well. I
> > think it is worth it, though. The function is called only to return the
> > current value to userspace and mem_cgroup_swappiness_write guaranties
> > that it falls down into <0,100> interval. Additionally, cftype doesn't
> > have any read specialization for int values so you would need to use a
> > generic one. Finally if you changed read part you should change also
> > write part and add > 0 check which is a lot of code for not that good
> > reason.
> 
> I don't want to make this type-clean. 

Agreed.

> Should I add type casting as
> ==
>  return (u64) mem_cgroup_swappiness(memcg);
> ==
> ?

I do not think it is necessary. The value is promoted to u64
automatically.

-- 
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:[~2011-06-30  7:33 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-29 10:03 [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v2 KAMEZAWA Hiroyuki
2011-06-29 10:03 ` KAMEZAWA Hiroyuki
2011-06-29 12:20 ` Michal Hocko
2011-06-29 12:20   ` Michal Hocko
2011-06-29 13:00 ` Balbir Singh
2011-06-29 13:00   ` Balbir Singh
2011-06-29 20:00 ` Andrew Morton
2011-06-29 20:00   ` Andrew Morton
2011-06-30  3:32   ` KAMEZAWA Hiroyuki
2011-06-30  3:32     ` KAMEZAWA Hiroyuki
2011-06-30  6:32     ` Michal Hocko
2011-06-30  6:32       ` Michal Hocko
2011-06-30  7:10       ` KAMEZAWA Hiroyuki
2011-06-30  7:10         ` KAMEZAWA Hiroyuki
2011-06-30  7:33         ` Michal Hocko [this message]
2011-06-30  7:33           ` Michal Hocko
2011-06-30 20:01 ` Andrew Morton
2011-06-30 20:01   ` Andrew Morton
2011-06-30 23:50   ` KAMEZAWA Hiroyuki
2011-06-30 23:50     ` KAMEZAWA Hiroyuki
2011-07-01  0:20     ` KAMEZAWA Hiroyuki
2011-07-01  0:20       ` KAMEZAWA Hiroyuki
2011-07-01  1:06       ` Andrew Morton
2011-07-01  1:06         ` Andrew Morton
2011-07-01  1:16         ` KAMEZAWA Hiroyuki
2011-07-01  1:16           ` KAMEZAWA Hiroyuki
2011-07-01  1:30           ` KAMEZAWA Hiroyuki
2011-07-01  1:30             ` KAMEZAWA Hiroyuki
2011-07-01  7:10             ` KAMEZAWA Hiroyuki
2011-07-01  7:10               ` KAMEZAWA Hiroyuki
2011-07-06  5:18               ` [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v5 KAMEZAWA Hiroyuki
2011-07-06  5:18                 ` 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=20110630073300.GA13560@tiehlicka.suse.cz \
    --to=mhocko@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=bsingharora@gmail.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nishimura@mxp.nes.nec.co.jp \
    --cc=yinghan@google.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.