From: Li Zefan <lizf@cn.fujitsu.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
"balbir@linux.vnet.ibm.com" <balbir@linux.vnet.ibm.com>,
"nishimura@mxp.nes.nec.co.jp" <nishimura@mxp.nes.nec.co.jp>,
pbadari@us.ibm.com, jblunck@suse.de, taka@valinux.co.jp,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 7/9] memcg : mem+swap controlelr core
Date: Fri, 21 Nov 2008 10:40:07 +0800 [thread overview]
Message-ID: <49261F87.50209@cn.fujitsu.com> (raw)
In-Reply-To: <20081114191949.926bf99d.kamezawa.hiroyu@jp.fujitsu.com>
> @@ -513,12 +531,25 @@ static int __mem_cgroup_try_charge(struc
> css_get(&mem->css);
> }
>
> + while (1) {
This loop will never break out if memory.limit_in_bytes is too low.
Actually, when I set the limit to 0 and moved a task into the cgroup and let
the task allocate a page, then the whole system froze, and I had to reset
my machine.
And small memory.limit will make the process stuck:
# mkdir /memcg/0
# echo 40K > /memcg/0/memory.limit_in_bytes
# echo $$ > tasks
# ls
(stuck)
(another console)
# echo 100K > /memcg/0/memory.limit_in_bytes
(then the above 'ls' can continue)
> + int ret;
> + bool noswap = false;
>
> - while (unlikely(res_counter_charge(&mem->res, PAGE_SIZE))) {
> + ret = res_counter_charge(&mem->res, PAGE_SIZE);
> + if (likely(!ret)) {
> + if (!do_swap_account)
> + break;
> + ret = res_counter_charge(&mem->memsw, PAGE_SIZE);
> + if (likely(!ret))
> + break;
> + /* mem+swap counter fails */
> + res_counter_uncharge(&mem->res, PAGE_SIZE);
> + noswap = true;
> + }
> if (!(gfp_mask & __GFP_WAIT))
> goto nomem;
>
> - if (try_to_free_mem_cgroup_pages(mem, gfp_mask))
> + if (try_to_free_mem_cgroup_pages(mem, gfp_mask, noswap))
> continue;
>
> /*
> @@ -527,8 +558,13 @@ static int __mem_cgroup_try_charge(struc
> * moved to swap cache or just unmapped from the cgroup.
> * Check the limit again to see if the reclaim reduced the
> * current usage of the cgroup before giving up
> + *
> */
> - if (res_counter_check_under_limit(&mem->res))
> + if (!do_swap_account &&
> + res_counter_check_under_limit(&mem->res))
> + continue;
> + if (do_swap_account &&
> + res_counter_check_under_limit(&mem->memsw))
> continue;
>
> if (!nr_retries--) {
WARNING: multiple messages have this Message-ID (diff)
From: Li Zefan <lizf@cn.fujitsu.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
"balbir@linux.vnet.ibm.com" <balbir@linux.vnet.ibm.com>,
"nishimura@mxp.nes.nec.co.jp" <nishimura@mxp.nes.nec.co.jp>,
pbadari@us.ibm.com, jblunck@suse.de, taka@valinux.co.jp,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 7/9] memcg : mem+swap controlelr core
Date: Fri, 21 Nov 2008 10:40:07 +0800 [thread overview]
Message-ID: <49261F87.50209@cn.fujitsu.com> (raw)
In-Reply-To: <20081114191949.926bf99d.kamezawa.hiroyu@jp.fujitsu.com>
> @@ -513,12 +531,25 @@ static int __mem_cgroup_try_charge(struc
> css_get(&mem->css);
> }
>
> + while (1) {
This loop will never break out if memory.limit_in_bytes is too low.
Actually, when I set the limit to 0 and moved a task into the cgroup and let
the task allocate a page, then the whole system froze, and I had to reset
my machine.
And small memory.limit will make the process stuck:
# mkdir /memcg/0
# echo 40K > /memcg/0/memory.limit_in_bytes
# echo $$ > tasks
# ls
(stuck)
(another console)
# echo 100K > /memcg/0/memory.limit_in_bytes
(then the above 'ls' can continue)
> + int ret;
> + bool noswap = false;
>
> - while (unlikely(res_counter_charge(&mem->res, PAGE_SIZE))) {
> + ret = res_counter_charge(&mem->res, PAGE_SIZE);
> + if (likely(!ret)) {
> + if (!do_swap_account)
> + break;
> + ret = res_counter_charge(&mem->memsw, PAGE_SIZE);
> + if (likely(!ret))
> + break;
> + /* mem+swap counter fails */
> + res_counter_uncharge(&mem->res, PAGE_SIZE);
> + noswap = true;
> + }
> if (!(gfp_mask & __GFP_WAIT))
> goto nomem;
>
> - if (try_to_free_mem_cgroup_pages(mem, gfp_mask))
> + if (try_to_free_mem_cgroup_pages(mem, gfp_mask, noswap))
> continue;
>
> /*
> @@ -527,8 +558,13 @@ static int __mem_cgroup_try_charge(struc
> * moved to swap cache or just unmapped from the cgroup.
> * Check the limit again to see if the reclaim reduced the
> * current usage of the cgroup before giving up
> + *
> */
> - if (res_counter_check_under_limit(&mem->res))
> + if (!do_swap_account &&
> + res_counter_check_under_limit(&mem->res))
> + continue;
> + if (do_swap_account &&
> + res_counter_check_under_limit(&mem->memsw))
> continue;
>
> if (!nr_retries--) {
--
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-11-21 2:40 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-14 10:12 [PATCH 0/9] memcg updates (14/Nov/2008) KAMEZAWA Hiroyuki
2008-11-14 10:12 ` KAMEZAWA Hiroyuki
2008-11-14 10:14 ` [PATCH 1/9] memcg: memory hotpluf fix for notifier callback KAMEZAWA Hiroyuki
2008-11-14 10:14 ` KAMEZAWA Hiroyuki
2008-11-14 10:15 ` [PATCH 2/9] memcg : reduce size of mem_cgroup by using nr_cpu_ids KAMEZAWA Hiroyuki
2008-11-14 10:15 ` KAMEZAWA Hiroyuki
2008-11-14 10:16 ` [PATCH 3/9] memcg: new force_empty to free pages under group KAMEZAWA Hiroyuki
2008-11-14 10:16 ` KAMEZAWA Hiroyuki
2008-11-14 10:17 ` [PATCH 4/9] memcg: handle swap caches KAMEZAWA Hiroyuki
2008-11-14 10:17 ` KAMEZAWA Hiroyuki
2008-11-14 10:18 ` [PATCH 5/9] memcg : mem+swap controller Kconfig KAMEZAWA Hiroyuki
2008-11-14 10:18 ` KAMEZAWA Hiroyuki
2008-11-14 10:18 ` [PATCH 6/9] memcg : swap cgroup for remembering usage KAMEZAWA Hiroyuki
2008-11-14 10:18 ` KAMEZAWA Hiroyuki
2008-11-14 10:19 ` [PATCH 7/9] memcg : mem+swap controlelr core KAMEZAWA Hiroyuki
2008-11-14 10:19 ` KAMEZAWA Hiroyuki
2008-11-21 2:40 ` Li Zefan [this message]
2008-11-21 2:40 ` Li Zefan
2008-11-21 2:44 ` KAMEZAWA Hiroyuki
2008-11-21 2:44 ` KAMEZAWA Hiroyuki
2008-11-21 9:58 ` [PATCH 0/2] memcg: fix oom handling KAMEZAWA Hiroyuki
2008-11-21 9:58 ` KAMEZAWA Hiroyuki
2008-11-21 10:01 ` [PATCH 1/2] memcg: avoid unnecessary system-wide-oom-killer KAMEZAWA Hiroyuki
2008-11-21 10:01 ` KAMEZAWA Hiroyuki
2008-11-21 10:03 ` [PATCH 2/2] memcg: fix reclaim result checks KAMEZAWA Hiroyuki
2008-11-21 10:03 ` KAMEZAWA Hiroyuki
2008-11-22 2:16 ` [PATCH 0/2] memcg: fix oom handling Li Zefan
2008-11-22 2:16 ` Li Zefan
2008-11-14 10:20 ` [PATCH 8/9] memcg : synchronized LRU KAMEZAWA Hiroyuki
2008-11-14 10:20 ` KAMEZAWA Hiroyuki
2008-11-14 10:21 ` [PATCH 9/9] memcg : add mem_cgroup_disabled() KAMEZAWA Hiroyuki
2008-11-14 10:21 ` KAMEZAWA Hiroyuki
2008-11-14 11:33 ` [PATCH 0/9] memcg updates (14/Nov/2008) Balbir Singh
2008-11-14 11:33 ` Balbir Singh
2008-11-15 3:00 ` KAMEZAWA Hiroyuki
2008-11-15 7:25 ` Balbir Singh
2008-11-15 9:16 ` KAMEZAWA Hiroyuki
2008-11-15 9:19 ` Balbir Singh
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=49261F87.50209@cn.fujitsu.com \
--to=lizf@cn.fujitsu.com \
--cc=akpm@linux-foundation.org \
--cc=balbir@linux.vnet.ibm.com \
--cc=jblunck@suse.de \
--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=pbadari@us.ibm.com \
--cc=taka@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 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.