All of lore.kernel.org
 help / color / mirror / Atom feed
From: jacob pan <jacob.jun.pan-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
To: Li Zefan <lizf-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
Cc: container cgroup
	<containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>,
	LKML <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	rdunlap-/UHa2rfvQTnk1uMJSBkQmQ@public.gmane.org,
	Cedric Le Goater <clg-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org>,
	Paul Menage <menage-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
	Arjan van de Ven <arjan-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
	akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org
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__46319.4045042202$1297313614$gmane$org@jacob-laptop> (raw)
In-Reply-To: <4D52050F.3060907-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>

On Wed, 09 Feb 2011 11:07:59 +0800
Li Zefan <lizf-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org> 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: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-09  1:05 [PATCH 1/1, v6] cgroup/freezer: add per freezer duty ratio control 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  1:26     ` Li Zefan
2011-02-10  4:43       ` jacob pan
     [not found]       ` <4D533EB0.6060405-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2011-02-10  4:43         ` jacob pan
     [not found]   ` <4D52050F.3060907-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2011-02-09 18:16     ` jacob pan
2011-02-10  4:51     ` jacob pan [this message]
2011-02-10  4:51   ` jacob pan
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-10 22:43         ` Matt Helsley
     [not found]       ` <20110210191117.GI16432-52DBMbEzqgQ/wnmkkaCWp/UQ3DHhIser@public.gmane.org>
2011-02-10 22:22         ` jacob pan
     [not found]     ` <4D535627.9090606-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2011-02-10 19:11       ` Matt Helsley
2011-02-14 18:03       ` Vaidyanathan Srinivasan
2011-02-14 18:03     ` Vaidyanathan Srinivasan
2011-02-10  9:15   ` Kirill A. Shutemov
2011-02-10 18:58     ` Matt Helsley
     [not found]     ` <20110210091522.GA28511-oKw7cIdHH8eLwutG50LtGA@public.gmane.org>
2011-02-10 18:58       ` Matt Helsley
2011-02-10 23:06   ` Jacob Pan
     [not found]   ` <20110210030442.GG16432-52DBMbEzqgQ/wnmkkaCWp/UQ3DHhIser@public.gmane.org>
2011-02-10  3:06     ` Arjan van de Ven
2011-02-10  9:15     ` Kirill A. Shutemov
2011-02-10 23:06     ` Jacob Pan
     [not found] ` <1297213541-18156-1-git-send-email-jacob.jun.pan-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2011-02-09  3:07   ` Li Zefan
2011-02-10  3:04   ` Matt Helsley
2011-02-09  1:05 jacob.jun.pan-VuQAYsv1563Yd54FQh9/CA

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__46319.4045042202$1297313614$gmane$org@jacob-laptop' \
    --to=jacob.jun.pan-vuqaysv1563yd54fqh9/ca@public.gmane.org \
    --cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
    --cc=arjan-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=clg-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org \
    --cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=lizf-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org \
    --cc=menage-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=rdunlap-/UHa2rfvQTnk1uMJSBkQmQ@public.gmane.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 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.