From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
To: balbir@linux.vnet.ibm.com
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
LKML <linux-kernel@vger.kernel.org>,
"xemul@openvz.org" <xemul@openvz.org>,
"menage@google.com" <menage@google.com>,
"lizf@cn.fujitsu.com" <lizf@cn.fujitsu.com>,
"yamamoto@valinux.co.jp" <yamamoto@valinux.co.jp>,
"nishimura@mxp.nes.nec.co.jp" <nishimura@mxp.nes.nec.co.jp>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 1/2] memcg: res counter set limit
Date: Tue, 17 Jun 2008 13:05:04 +0900 [thread overview]
Message-ID: <20080617130504.15864ae8.kamezawa.hiroyu@jp.fujitsu.com> (raw)
In-Reply-To: <48573236.2060700@linux.vnet.ibm.com>
On Tue, 17 Jun 2008 09:10:38 +0530
Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
> KAMEZAWA Hiroyuki wrote:
> > Helper function of res_counter for reducing usage in subsys(memcg).
> >
> > Changelog xxx -> v5.
> > - new file.
> >
> > Background:
> > In v3, I was asked to implement generic ones to res_counter.
> > In v4. I was asked not to implement generic ones because memcg is only
> > controller which can reduce usage by the kernel. Okay, maybe make sense.
> > In this version, adds only necessary helpers to res_counter in
> > not-invasive manner.
> >
> > Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> >
> > ---
> > include/linux/res_counter.h | 7 +++++++
> > kernel/res_counter.c | 24 ++++++++++++++++++++++++
> > 2 files changed, 31 insertions(+)
> >
> > Index: mm-2.6.26-rc5-mm3/include/linux/res_counter.h
> > ===================================================================
> > --- mm-2.6.26-rc5-mm3.orig/include/linux/res_counter.h
> > +++ mm-2.6.26-rc5-mm3/include/linux/res_counter.h
> > @@ -136,6 +136,12 @@ static inline bool res_counter_check_und
> > return ret;
> > }
> >
> > +/*
> > + * set new limit to the val. if usage > val, returns -EBUSY.
> > + * returns 0 at success.
> > + */
> > +int res_counter_set_limit(struct res_counter *cnt, unsigned long long limit);
> > +
> > static inline void res_counter_reset_max(struct res_counter *cnt)
> > {
> > unsigned long flags;
> > @@ -153,4 +159,5 @@ static inline void res_counter_reset_fai
> > cnt->failcnt = 0;
> > spin_unlock_irqrestore(&cnt->lock, flags);
> > }
> > +
>
> I don't understand this extra newline here
>
Sorry. I'll remove this ;)
Thanks,
-Kame
> > #endif
> > Index: mm-2.6.26-rc5-mm3/kernel/res_counter.c
> > ===================================================================
> > --- mm-2.6.26-rc5-mm3.orig/kernel/res_counter.c
> > +++ mm-2.6.26-rc5-mm3/kernel/res_counter.c
> > @@ -143,3 +143,27 @@ out_free:
> > out:
> > return ret;
> > }
> > +
> > +
> > +/**
> > + * res_counter_set_limit - set limit of res_counter.
> > + * @cnt: the res_counter
> > + * @limit: the new limit
> > + *
> > + * Note that res_coutner_write() allows the same kind of operation.
> > + * But this returns -EBUSY when new limit < usage. If you want strict control
> > + * of limit, please use this.
> > + */
> > +int res_counter_set_limit(struct res_counter *cnt, unsigned long long limit)
> > +{
> > + unsigned long flags;
> > + int ret = -EBUSY;
> > +
> > + spin_lock_irqsave(&cnt->lock, flags);
> > + if (cnt->usage <= limit) {
> > + cnt->limit = limit;
> > + ret = 0;
> > + }
> > + spin_unlock_irqrestore(&cnt->lock, flags);
> > + return ret;
> > +}
>
> Reviewed-by: Balbir Singh <balbir@linux.vnet.ibm.com>
>
> --
> Warm Regards,
> Balbir Singh
> Linux Technology Center
> IBM, ISTL
>
--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2008-06-17 4:05 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-17 3:31 [PATCH 0/2] memcg: Reduce usage at change limit KAMEZAWA Hiroyuki
2008-06-17 3:33 ` [PATCH 1/2] memcg: res counter set limit KAMEZAWA Hiroyuki
2008-06-17 3:40 ` Balbir Singh
2008-06-17 4:05 ` KAMEZAWA Hiroyuki [this message]
2008-06-17 3:36 ` [PATCH 2/2] memcg: reduce usage at change limit KAMEZAWA Hiroyuki
2008-06-17 3:46 ` Balbir Singh
2008-06-17 4:06 ` KAMEZAWA Hiroyuki
2008-06-17 10:00 ` KAMEZAWA Hiroyuki
2008-06-17 10:14 ` Balbir Singh
2008-06-17 12:03 ` kamezawa.hiroyu
2008-06-20 5:16 ` Paul Menage
2008-06-20 6:44 ` kamezawa.hiroyu
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=20080617130504.15864ae8.kamezawa.hiroyu@jp.fujitsu.com \
--to=kamezawa.hiroyu@jp.fujitsu.com \
--cc=akpm@linux-foundation.org \
--cc=balbir@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lizf@cn.fujitsu.com \
--cc=menage@google.com \
--cc=nishimura@mxp.nes.nec.co.jp \
--cc=xemul@openvz.org \
--cc=yamamoto@valinux.co.jp \
/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