login
Login
/
Register
Search
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2008
»
June
»
17
Re: [PATCH 2/2] memcg: reduce usage at change limit
view
thread
!MAILaRCHIVE_VOTE_RePLACE
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
[view in full thread]
From:
KAMEZAWA Hiroyuki <kamezawa.hiroyu@...>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...>
Cc: <balbir@...>, linux-mm@kvack.org <linux-mm@...>, LKML <linux-kernel@...>, xemul@openvz.org <xemul@...>, menage@google.com <menage@...>, lizf@cn.fujitsu.com <lizf@...>, yamamoto@valinux.co.jp <yamamoto@...>, nishimura@mxp.nes.nec.co.jp <nishimura@...>, Andrew Morton <akpm@...>
Subject:
Re: [PATCH 2/2] memcg: reduce usage at change limit
Date: Tuesday, June 17, 2008 - 6:00 am
On Tue, 17 Jun 2008 13:06:56 +0900 KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
quoted text
> On Tue, 17 Jun 2008 09:16:31 +0530 > Balbir Singh <balbir@linux.vnet.ibm.com> wrote: > > > KAMEZAWA Hiroyuki wrote: > > > Reduce the usage of res_counter at the change of limit. > > > > > > Changelog v4 -> v5. > > > - moved "feedback" alogrithm from res_counter to memcg. > > > > > > Background: > > > - Now, mem->usage is not reduced at limit change. So, the users will see > > > usage > limit case in memcg every time. This patch fixes it. > > > > > > Before: > > > - no usage change at setting limit. > > > - setting limit always returns 0 even if usage can never be less than zero. > > > (This can happen when memory is locked or there is no swap.) > > > - This is BUG, I think. > > > After: > > > - usage will be less than new limit at limit change. > > > - set limit returns -EBUSY when the usage cannot be reduced. > > > > > > > > > Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> > > > > > > --- > > > Documentation/controllers/memory.txt | 3 - > > > mm/memcontrol.c | 68 ++++++++++++++++++++++++++++------- > > > 2 files changed, 56 insertions(+), 15 deletions(-) > > > > > > Index: mm-2.6.26-rc5-mm3/mm/memcontrol.c > > > =================================================================== > > > --- mm-2.6.26-rc5-mm3.orig/mm/memcontrol.c > > > +++ mm-2.6.26-rc5-mm3/mm/memcontrol.c > > > @@ -852,18 +852,30 @@ out: > > > css_put(&mem->css); > > > return ret; > > > } > > > +/* > > > + * try to set limit and reduce usage if necessary. > > > + * returns 0 at success. > > > + * returns -EBUSY if memory cannot be dropped. > > > + */ > > > > > > -static int mem_cgroup_write_strategy(char *buf, unsigned long long *tmp) > > > +static inline int mem_cgroup_resize_limit(struct cgroup *cont, > > > + unsigned long long val) > > > { > > > - *tmp = memparse(buf, &buf); > > > - if (*buf != '__PLACEHOLDER__0_') > > > - return -EINVAL; > > > + struct mem_cgroup *memcg = mem_cgroup_from_cont(cont); > > > + int retry_count = 0; > > > + int progress; > > > > > > - /* > > > - * Round up the value to the closest page size > > > - */ > > > - *tmp = ((*tmp + PAGE_SIZE - 1) >> PAGE_SHIFT) << PAGE_SHIFT; > > > - return 0; > > > +retry: > > > + if (!res_counter_set_limit(&memcg->res, val)) > > > + return 0; > > > + if (retry_count == MEM_CGROUP_RECLAIM_RETRIES) > > > + return -EBUSY; > > > + > > > + cond_resched(); > > > > Do we really need this? We do have cond_resched in shrink_page_list(), > > shrink_active_list(), do we need it here as well? > > > I'd like to add this when adding a busy loop. But ok, will remove. > > > > + progress = try_to_free_mem_cgroup_pages(memcg, GFP_KERNEL); > > > + if (!progress) > > > + retry_count++; > > > + goto retry; > > > > I don't like upward goto's. Can't we convert this to a nice do {} while or > > while() loop? > > > Hmm, ok. > > I'll repost later, today. >
I'll postpone this until -mm is settled ;) Thanks, -Kame --
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
Messages in current thread:
[PATCH 0/2] memcg: Reduce usage at change limit
, KAMEZAWA Hiroyuki
, (Mon Jun 16, 11:31 pm)
[PATCH 2/2] memcg: reduce usage at change limit
, KAMEZAWA Hiroyuki
, (Mon Jun 16, 11:36 pm)
Re: [PATCH 2/2] memcg: reduce usage at change limit
, Paul Menage
, (Fri Jun 20, 1:16 am)
Re: Re: [PATCH 2/2] memcg: reduce usage at change limit
,
, (Fri Jun 20, 2:44 am)
Re: [PATCH 2/2] memcg: reduce usage at change limit
, Balbir Singh
, (Mon Jun 16, 11:46 pm)
Re: [PATCH 2/2] memcg: reduce usage at change limit
, KAMEZAWA Hiroyuki
, (Tue Jun 17, 12:06 am)
Re: [PATCH 2/2] memcg: reduce usage at change limit
, KAMEZAWA Hiroyuki
, (Tue Jun 17, 6:00 am)
Re: [PATCH 2/2] memcg: reduce usage at change limit
, Balbir Singh
, (Tue Jun 17, 6:14 am)
Re: Re: [PATCH 2/2] memcg: reduce usage at change limit
,
, (Tue Jun 17, 8:03 am)
[PATCH 1/2] memcg: res counter set limit
, KAMEZAWA Hiroyuki
, (Mon Jun 16, 11:33 pm)
Re: [PATCH 1/2] memcg: res counter set limit
, Balbir Singh
, (Mon Jun 16, 11:40 pm)
Re: [PATCH 1/2] memcg: res counter set limit
, KAMEZAWA Hiroyuki
, (Tue Jun 17, 12:05 am)
Navigation
Create content
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Tarkan Erimer
Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3
Jesper Krogh
Re: Linux 2.6.26-rc4
Thomas Gleixner
Re: Linux 2.6.21-rc1
Hugh Dickins
Re: [bug?] tg3: Failed to load firmware "tigon/tg3_tso.bin"
git
:
linux-netdev
:
Antonio Almeida
HTB accuracy for high speed
Jarek Poplawski
[PATCH] pkt_sched: Destroy gen estimators under rtnl_lock().
Gerrit Renker
[PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side)
David Miller
[GIT]: Networking
openbsd-misc
:
Colocation donated by:
Who's online
There are currently
4 users
and
872 guests
online.
Online users
zeekec
twitterfollowb
jengalz
mercre40
Syndicate