mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: jacob pan <jacob.jun.pan@linux.intel.com>
To: Li Zefan <lizf@cn.fujitsu.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	"Kirill A. Shutemov" <kirill@shutemov.name>,
	Arjan van de Ven <arjan@linux.intel.com>,
	Matt Helsley <matthltc@us.ibm.com>,
	container cgroup <containers@lists.linux-foundation.org>,
	Paul Menage <menage@google.com>,
	akpm@linux-foundation.org, rdunlap@xenotime.net,
	Cedric Le Goater <clg@fr.ibm.com>
Subject: Re: [PATCH 1/1, v6] cgroup/freezer: add per freezer duty ratio control
Date: Wed, 9 Feb 2011 20:51:33 -0800	[thread overview]
Message-ID: <20110209205133.5146a9fb@jacob-laptop> (raw)
In-Reply-To: <4D52050F.3060907@cn.fujitsu.com>

On Wed, 09 Feb 2011 11:07:59 +0800
Li Zefan <lizf@cn.fujitsu.com> wrote:


> >  
> > +#define FREEZER_KH_PREFIX  "freezer_"
> > +static int freezer_write_param(struct cgroup *cgroup, struct
> > cftype *cft,
> > +		u64 val)
> > +{
> > +	struct freezer *freezer;
> > +	char thread_name[32];
> > +	int ret = 0;
> > +
> > +	freezer = cgroup_freezer(cgroup);
> > +
> > +	if (!cgroup_lock_live_group(cgroup))
> > +		return -ENODEV;
> > +
> > +	switch (cft->private) {
> > +	case FREEZER_DUTY_RATIO:
> > +		if (val >= 100 || val < 0) {
> 
> val will never < 0.
good point, I will fix it.

> 
> > +			ret = -EINVAL;
> > +			goto exit;
> > +		}
> > +		freezer->duty.ratio = val;
> > +		break;
> > +	case FREEZER_PERIOD:
> > +		if (val)
> > +			do_div(val, 100);
> 
> Is 0 an invalid value for do_div()?
0 is valid. I was thinking about divide by 0 by mistake. will fix it.

> 
> > +			freezer->duty.period_pct_ms = val;
> > +		break;
> > +	default:
> > +		BUG();
> > +	}
> > +
> > +	/* start/stop management kthread as needed, the rule is
> > that
> > +	 * if both duty ratio and period values are zero, then no
> > management
> > +	 * kthread is created. when both are non-zero, we create a
> > kthread
> > +	 * for the cgroup. When user set zero to duty ratio and
> > period again
> > +	 * the kthread is stopped.
> > +	 */
> > +	if (freezer->duty.ratio && freezer->duty.period_pct_ms) {
> > +		if (!freezer->fkh) {
> > +			snprintf(thread_name, 32, "%s%s",
> > FREEZER_KH_PREFIX,
> > +				cgroup->dentry->d_name.name);
> > +			freezer->fkh = kthread_run(freezer_kh,
> > (void *)cgroup,
> > +						thread_name);
> > +			if (IS_ERR(freezer_task)) {
> 
> You mean IS_ERR(freezer->fkh)?
Right, same bug for PTR_ERR. will fix.

thanks.

  parent reply	other threads:[~2011-02-10  4:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-09  1:05 jacob.jun.pan
2011-02-09  3:07 ` Li Zefan
2011-02-09 18:16   ` jacob pan
2011-02-10  1:26     ` Li Zefan
2011-02-10  4:43       ` jacob pan
2011-02-10  4:51   ` jacob pan [this message]
2011-02-10  3:04 ` Matt Helsley
2011-02-10  3:06   ` Arjan van de Ven
2011-02-10 19:11     ` Matt Helsley
2011-02-10 22:22       ` jacob pan
2011-02-10 22:43         ` Matt Helsley
2011-02-14 18:03     ` Vaidyanathan Srinivasan
2011-02-10  9:15   ` Kirill A. Shutemov
2011-02-10 18:58     ` Matt Helsley
2011-02-10 23:06   ` Jacob Pan

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=20110209205133.5146a9fb@jacob-laptop \
    --to=jacob.jun.pan@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@linux.intel.com \
    --cc=clg@fr.ibm.com \
    --cc=containers@lists.linux-foundation.org \
    --cc=kirill@shutemov.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=matthltc@us.ibm.com \
    --cc=menage@google.com \
    --cc=rdunlap@xenotime.net \
    /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

Powered by JetHome