From: Sha Zhengju <handai.szj-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Michal Hocko <mhocko-AlSwsSmVLrQ@public.gmane.org>
Cc: linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org,
cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org,
akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org,
rientjes-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Sha Zhengju <handai.szj-3b8fjiQLQpfQT0dZR+AlfA@public.gmane.org>
Subject: Re: [PATCH 1/2] memcg, oom: provide more precise dump info while memcg oom happening
Date: Thu, 08 Nov 2012 20:45:30 +0800 [thread overview]
Message-ID: <509BA96A.2070701@gmail.com> (raw)
In-Reply-To: <20121107221709.GB26382-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
On 11/08/2012 06:17 AM, Michal Hocko wrote:
> On Wed 07-11-12 16:41:36, Sha Zhengju wrote:
>> From: Sha Zhengju<handai.szj-3b8fjiQLQpfQT0dZR+AlfA@public.gmane.org>
>>
>> Current, when a memcg oom is happening the oom dump messages is still global
>> state and provides few useful info for users. This patch prints more pointed
>> memcg page statistics for memcg-oom.
>>
>> Signed-off-by: Sha Zhengju<handai.szj-3b8fjiQLQpfQT0dZR+AlfA@public.gmane.org>
>> Cc: Michal Hocko<mhocko-AlSwsSmVLrQ@public.gmane.org>
>> Cc: KAMEZAWA Hiroyuki<kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
>> Cc: David Rientjes<rientjes-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
>> Cc: Andrew Morton<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
>> ---
>> mm/memcontrol.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++-------
>> mm/oom_kill.c | 6 +++-
>> 2 files changed, 66 insertions(+), 11 deletions(-)
>>
>> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
>> index 0eab7d5..2df5e72 100644
>> --- a/mm/memcontrol.c
>> +++ b/mm/memcontrol.c
> [...]
>> @@ -1501,8 +1509,59 @@ static void move_unlock_mem_cgroup(struct mem_cgroup *memcg,
>> spin_unlock_irqrestore(&memcg->move_lock, *flags);
>> }
>>
>> +#define K(x) ((x)<< (PAGE_SHIFT-10))
>> +static void mem_cgroup_print_oom_stat(struct mem_cgroup *memcg)
>> +{
>> + struct mem_cgroup *mi;
>> + unsigned int i;
>> +
>> + if (!memcg->use_hierarchy&& memcg != root_mem_cgroup) {
>> + for (i = 0; i< MEM_CGROUP_STAT_NSTATS; i++) {
>> + if (i == MEM_CGROUP_STAT_SWAP&& !do_swap_account)
>> + continue;
>> + printk(KERN_CONT "%s:%ldKB ", mem_cgroup_stat_names[i],
>> + K(mem_cgroup_read_stat(memcg, i)));
>> + }
>> +
>> + for (i = 0; i< MEM_CGROUP_EVENTS_NSTATS; i++)
>> + printk(KERN_CONT "%s:%lu ", mem_cgroup_events_names[i],
>> + mem_cgroup_read_events(memcg, i));
>> +
>> + for (i = 0; i< NR_LRU_LISTS; i++)
>> + printk(KERN_CONT "%s:%luKB ", mem_cgroup_lru_names[i],
>> + K(mem_cgroup_nr_lru_pages(memcg, BIT(i))));
>> + } else {
>> +
>> + for (i = 0; i< MEM_CGROUP_STAT_NSTATS; i++) {
>> + long long val = 0;
>> +
>> + if (i == MEM_CGROUP_STAT_SWAP&& !do_swap_account)
>> + continue;
>> + for_each_mem_cgroup_tree(mi, memcg)
>> + val += mem_cgroup_read_stat(mi, i);
>> + printk(KERN_CONT "%s:%lldKB ", mem_cgroup_stat_names[i], K(val));
>> + }
>> +
>> + for (i = 0; i< MEM_CGROUP_EVENTS_NSTATS; i++) {
>> + unsigned long long val = 0;
>> +
>> + for_each_mem_cgroup_tree(mi, memcg)
>> + val += mem_cgroup_read_events(mi, i);
>> + printk(KERN_CONT "%s:%llu ",
>> + mem_cgroup_events_names[i], val);
>> + }
>> +
>> + for (i = 0; i< NR_LRU_LISTS; i++) {
>> + unsigned long long val = 0;
>> +
>> + for_each_mem_cgroup_tree(mi, memcg)
>> + val += mem_cgroup_nr_lru_pages(mi, BIT(i));
>> + printk(KERN_CONT "%s:%lluKB ", mem_cgroup_lru_names[i], K(val));
>> + }
>> + }
> This is just plain ugly. for_each_mem_cgroup_tree is use_hierarchy aware
> and there is no need for if (use_hierarchy) part.
> memcg != root_mem_cgroup test doesn't make much sense as well because we
> call that a global oom killer ;)
Yes... bitterly did I repent the patch... The else-part of
for_each_mem_cgroup_tree
is enough for hierarchy. I'll send a update one later.
Sorry for the noise. : (
Thanks,
Sha
WARNING: multiple messages have this Message-ID (diff)
From: Sha Zhengju <handai.szj@gmail.com>
To: Michal Hocko <mhocko@suse.cz>
Cc: linux-mm@kvack.org, cgroups@vger.kernel.org,
kamezawa.hiroyu@jp.fujitsu.com, akpm@linux-foundation.org,
rientjes@google.com, linux-kernel@vger.kernel.org,
Sha Zhengju <handai.szj@taobao.com>
Subject: Re: [PATCH 1/2] memcg, oom: provide more precise dump info while memcg oom happening
Date: Thu, 08 Nov 2012 20:45:30 +0800 [thread overview]
Message-ID: <509BA96A.2070701@gmail.com> (raw)
In-Reply-To: <20121107221709.GB26382@dhcp22.suse.cz>
On 11/08/2012 06:17 AM, Michal Hocko wrote:
> On Wed 07-11-12 16:41:36, Sha Zhengju wrote:
>> From: Sha Zhengju<handai.szj@taobao.com>
>>
>> Current, when a memcg oom is happening the oom dump messages is still global
>> state and provides few useful info for users. This patch prints more pointed
>> memcg page statistics for memcg-oom.
>>
>> Signed-off-by: Sha Zhengju<handai.szj@taobao.com>
>> Cc: Michal Hocko<mhocko@suse.cz>
>> Cc: KAMEZAWA Hiroyuki<kamezawa.hiroyu@jp.fujitsu.com>
>> Cc: David Rientjes<rientjes@google.com>
>> Cc: Andrew Morton<akpm@linux-foundation.org>
>> ---
>> mm/memcontrol.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++-------
>> mm/oom_kill.c | 6 +++-
>> 2 files changed, 66 insertions(+), 11 deletions(-)
>>
>> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
>> index 0eab7d5..2df5e72 100644
>> --- a/mm/memcontrol.c
>> +++ b/mm/memcontrol.c
> [...]
>> @@ -1501,8 +1509,59 @@ static void move_unlock_mem_cgroup(struct mem_cgroup *memcg,
>> spin_unlock_irqrestore(&memcg->move_lock, *flags);
>> }
>>
>> +#define K(x) ((x)<< (PAGE_SHIFT-10))
>> +static void mem_cgroup_print_oom_stat(struct mem_cgroup *memcg)
>> +{
>> + struct mem_cgroup *mi;
>> + unsigned int i;
>> +
>> + if (!memcg->use_hierarchy&& memcg != root_mem_cgroup) {
>> + for (i = 0; i< MEM_CGROUP_STAT_NSTATS; i++) {
>> + if (i == MEM_CGROUP_STAT_SWAP&& !do_swap_account)
>> + continue;
>> + printk(KERN_CONT "%s:%ldKB ", mem_cgroup_stat_names[i],
>> + K(mem_cgroup_read_stat(memcg, i)));
>> + }
>> +
>> + for (i = 0; i< MEM_CGROUP_EVENTS_NSTATS; i++)
>> + printk(KERN_CONT "%s:%lu ", mem_cgroup_events_names[i],
>> + mem_cgroup_read_events(memcg, i));
>> +
>> + for (i = 0; i< NR_LRU_LISTS; i++)
>> + printk(KERN_CONT "%s:%luKB ", mem_cgroup_lru_names[i],
>> + K(mem_cgroup_nr_lru_pages(memcg, BIT(i))));
>> + } else {
>> +
>> + for (i = 0; i< MEM_CGROUP_STAT_NSTATS; i++) {
>> + long long val = 0;
>> +
>> + if (i == MEM_CGROUP_STAT_SWAP&& !do_swap_account)
>> + continue;
>> + for_each_mem_cgroup_tree(mi, memcg)
>> + val += mem_cgroup_read_stat(mi, i);
>> + printk(KERN_CONT "%s:%lldKB ", mem_cgroup_stat_names[i], K(val));
>> + }
>> +
>> + for (i = 0; i< MEM_CGROUP_EVENTS_NSTATS; i++) {
>> + unsigned long long val = 0;
>> +
>> + for_each_mem_cgroup_tree(mi, memcg)
>> + val += mem_cgroup_read_events(mi, i);
>> + printk(KERN_CONT "%s:%llu ",
>> + mem_cgroup_events_names[i], val);
>> + }
>> +
>> + for (i = 0; i< NR_LRU_LISTS; i++) {
>> + unsigned long long val = 0;
>> +
>> + for_each_mem_cgroup_tree(mi, memcg)
>> + val += mem_cgroup_nr_lru_pages(mi, BIT(i));
>> + printk(KERN_CONT "%s:%lluKB ", mem_cgroup_lru_names[i], K(val));
>> + }
>> + }
> This is just plain ugly. for_each_mem_cgroup_tree is use_hierarchy aware
> and there is no need for if (use_hierarchy) part.
> memcg != root_mem_cgroup test doesn't make much sense as well because we
> call that a global oom killer ;)
Yes... bitterly did I repent the patch... The else-part of
for_each_mem_cgroup_tree
is enough for hierarchy. I'll send a update one later.
Sorry for the noise. : (
Thanks,
Sha
--
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>
WARNING: multiple messages have this Message-ID (diff)
From: Sha Zhengju <handai.szj@gmail.com>
To: Michal Hocko <mhocko@suse.cz>
Cc: linux-mm@kvack.org, cgroups@vger.kernel.org,
kamezawa.hiroyu@jp.fujitsu.com, akpm@linux-foundation.org,
rientjes@google.com, linux-kernel@vger.kernel.org,
Sha Zhengju <handai.szj@taobao.com>
Subject: Re: [PATCH 1/2] memcg, oom: provide more precise dump info while memcg oom happening
Date: Thu, 08 Nov 2012 20:45:30 +0800 [thread overview]
Message-ID: <509BA96A.2070701@gmail.com> (raw)
In-Reply-To: <20121107221709.GB26382@dhcp22.suse.cz>
On 11/08/2012 06:17 AM, Michal Hocko wrote:
> On Wed 07-11-12 16:41:36, Sha Zhengju wrote:
>> From: Sha Zhengju<handai.szj@taobao.com>
>>
>> Current, when a memcg oom is happening the oom dump messages is still global
>> state and provides few useful info for users. This patch prints more pointed
>> memcg page statistics for memcg-oom.
>>
>> Signed-off-by: Sha Zhengju<handai.szj@taobao.com>
>> Cc: Michal Hocko<mhocko@suse.cz>
>> Cc: KAMEZAWA Hiroyuki<kamezawa.hiroyu@jp.fujitsu.com>
>> Cc: David Rientjes<rientjes@google.com>
>> Cc: Andrew Morton<akpm@linux-foundation.org>
>> ---
>> mm/memcontrol.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++-------
>> mm/oom_kill.c | 6 +++-
>> 2 files changed, 66 insertions(+), 11 deletions(-)
>>
>> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
>> index 0eab7d5..2df5e72 100644
>> --- a/mm/memcontrol.c
>> +++ b/mm/memcontrol.c
> [...]
>> @@ -1501,8 +1509,59 @@ static void move_unlock_mem_cgroup(struct mem_cgroup *memcg,
>> spin_unlock_irqrestore(&memcg->move_lock, *flags);
>> }
>>
>> +#define K(x) ((x)<< (PAGE_SHIFT-10))
>> +static void mem_cgroup_print_oom_stat(struct mem_cgroup *memcg)
>> +{
>> + struct mem_cgroup *mi;
>> + unsigned int i;
>> +
>> + if (!memcg->use_hierarchy&& memcg != root_mem_cgroup) {
>> + for (i = 0; i< MEM_CGROUP_STAT_NSTATS; i++) {
>> + if (i == MEM_CGROUP_STAT_SWAP&& !do_swap_account)
>> + continue;
>> + printk(KERN_CONT "%s:%ldKB ", mem_cgroup_stat_names[i],
>> + K(mem_cgroup_read_stat(memcg, i)));
>> + }
>> +
>> + for (i = 0; i< MEM_CGROUP_EVENTS_NSTATS; i++)
>> + printk(KERN_CONT "%s:%lu ", mem_cgroup_events_names[i],
>> + mem_cgroup_read_events(memcg, i));
>> +
>> + for (i = 0; i< NR_LRU_LISTS; i++)
>> + printk(KERN_CONT "%s:%luKB ", mem_cgroup_lru_names[i],
>> + K(mem_cgroup_nr_lru_pages(memcg, BIT(i))));
>> + } else {
>> +
>> + for (i = 0; i< MEM_CGROUP_STAT_NSTATS; i++) {
>> + long long val = 0;
>> +
>> + if (i == MEM_CGROUP_STAT_SWAP&& !do_swap_account)
>> + continue;
>> + for_each_mem_cgroup_tree(mi, memcg)
>> + val += mem_cgroup_read_stat(mi, i);
>> + printk(KERN_CONT "%s:%lldKB ", mem_cgroup_stat_names[i], K(val));
>> + }
>> +
>> + for (i = 0; i< MEM_CGROUP_EVENTS_NSTATS; i++) {
>> + unsigned long long val = 0;
>> +
>> + for_each_mem_cgroup_tree(mi, memcg)
>> + val += mem_cgroup_read_events(mi, i);
>> + printk(KERN_CONT "%s:%llu ",
>> + mem_cgroup_events_names[i], val);
>> + }
>> +
>> + for (i = 0; i< NR_LRU_LISTS; i++) {
>> + unsigned long long val = 0;
>> +
>> + for_each_mem_cgroup_tree(mi, memcg)
>> + val += mem_cgroup_nr_lru_pages(mi, BIT(i));
>> + printk(KERN_CONT "%s:%lluKB ", mem_cgroup_lru_names[i], K(val));
>> + }
>> + }
> This is just plain ugly. for_each_mem_cgroup_tree is use_hierarchy aware
> and there is no need for if (use_hierarchy) part.
> memcg != root_mem_cgroup test doesn't make much sense as well because we
> call that a global oom killer ;)
Yes... bitterly did I repent the patch... The else-part of
for_each_mem_cgroup_tree
is enough for hierarchy. I'll send a update one later.
Sorry for the noise. : (
Thanks,
Sha
next prev parent reply other threads:[~2012-11-08 12:45 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-07 8:40 [PATCH V2 0/2] Provide more precise dump info for memcg-oom Sha Zhengju
2012-11-07 8:40 ` Sha Zhengju
2012-11-07 8:41 ` [PATCH 1/2] memcg, oom: provide more precise dump info while memcg oom happening Sha Zhengju
2012-11-07 8:41 ` Sha Zhengju
2012-11-07 18:02 ` David Rientjes
2012-11-07 18:02 ` David Rientjes
[not found] ` <alpine.DEB.2.00.1211070956540.27451-X6Q0R45D7oAcqpCFd4KODRPsWskHk0ljAL8bYrjMMd8@public.gmane.org>
2012-11-08 12:37 ` Sha Zhengju
2012-11-08 12:37 ` Sha Zhengju
2012-11-08 12:37 ` Sha Zhengju
[not found] ` <509BA799.505-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-11-08 12:44 ` Michal Hocko
2012-11-08 12:44 ` Michal Hocko
2012-11-08 12:44 ` Michal Hocko
[not found] ` <1352277696-21724-1-git-send-email-handai.szj-3b8fjiQLQpfQT0dZR+AlfA@public.gmane.org>
2012-11-07 22:17 ` Michal Hocko
2012-11-07 22:17 ` Michal Hocko
2012-11-07 22:17 ` Michal Hocko
[not found] ` <20121107221709.GB26382-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2012-11-08 12:45 ` Sha Zhengju [this message]
2012-11-08 12:45 ` Sha Zhengju
2012-11-08 12:45 ` Sha Zhengju
2012-11-08 9:07 ` Kamezawa Hiroyuki
2012-11-08 9:07 ` Kamezawa Hiroyuki
[not found] ` <509B7658.1020807-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2012-11-08 13:12 ` Sha Zhengju
2012-11-08 13:12 ` Sha Zhengju
2012-11-08 13:12 ` Sha Zhengju
[not found] ` <1352277602-21687-1-git-send-email-handai.szj-3b8fjiQLQpfQT0dZR+AlfA@public.gmane.org>
2012-11-07 8:41 ` [PATCH 2/2] oom: rework dump_tasks to optimize memcg-oom situation Sha Zhengju
2012-11-07 8:41 ` Sha Zhengju
2012-11-07 8:41 ` Sha Zhengju
[not found] ` <1352277719-21760-1-git-send-email-handai.szj-3b8fjiQLQpfQT0dZR+AlfA@public.gmane.org>
2012-11-07 18:07 ` David Rientjes
2012-11-07 18:07 ` David Rientjes
2012-11-07 18:07 ` David Rientjes
2012-11-07 22:34 ` Michal Hocko
2012-11-07 22:34 ` Michal Hocko
[not found] ` <20121107223437.GC26382-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2012-11-08 13:58 ` Sha Zhengju
2012-11-08 13:58 ` Sha Zhengju
2012-11-08 13:58 ` Sha Zhengju
2012-11-07 19:31 ` [PATCH V2 0/2] Provide more precise dump info for memcg-oom Andrew Morton
2012-11-07 19:31 ` Andrew Morton
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=509BA96A.2070701@gmail.com \
--to=handai.szj-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
--cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=handai.szj-3b8fjiQLQpfQT0dZR+AlfA@public.gmane.org \
--cc=kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org \
--cc=mhocko-AlSwsSmVLrQ@public.gmane.org \
--cc=rientjes-hpIqsD4AKlfQT0dZR+AlfA@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.