linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: gaoqiang <gaoqiangscut@gmail.com>
To: Michal Hocko <mhocko@suse.cz>
Cc: cgroups@vger.kernel.org, linux-mm@kvack.org
Subject: Re: question about memsw of memory cgroup-subsystem
Date: Mon, 16 Apr 2012 11:43:56 +0800	[thread overview]
Message-ID: <op.wct9zibjn27o5l@gaoqiang-d1.corp.qihoo.net> (raw)
In-Reply-To: <20120413144954.GA9227@tiehlicka.suse.cz>

[-- Attachment #1: Type: text/plain, Size: 1550 bytes --]

在 Fri, 13 Apr 2012 22:49:54 +0800,Michal Hocko <mhocko@suse.cz> 写道:

> [CC linux-mm]
>
> Hi,
>
> On Fri 13-04-12 18:00:10, gaoqiang wrote:
>>
>>
>> I put a single process into a cgroup and set memory.limit_in_bytes
>> to 100M,and memory.memsw.limit_in_bytes to 1G.
>>
>> howevery,the process was oom-killed before mem+swap hit 1G. I tried
>> many times,and it was killed randomly when memory+swap
>>
>> exceed 100M but less than 1G.  what is the matter ?
>
> could you be more specific about your kernel version, workload and could
> you provide us with GROUP/memory.stat snapshots taken during your test?
>
> One reason for oom might be that you are hitting the hard limit (you
> cannot get over even if memsw limit says more) and you cannot swap out
> any pages (e.g. they are mlocked or under writeback).
>

many thanks.


The system is a vmware virtual machine,running centos6.2 with kernel  
2.6.32-220.7.1.el6.x86_64.

the attachments are memory.stat, the test program and the /var/log/message  
of the oom.

the workload is nearly 0,with searal sshd and bash program running.

I just did the following command when testing:

./t
# this program will pause at the "getchar()" line and in another  
terminal,run :

cgclear
service cgconfig restart
mkdir /cgroup/memory/test
cd /cgroup/memory/test
echo 100m > memory.limit_in_bytes
echo 1G > memory.memsw.limit_in_bytes
echo 'pid' > tasks

# then continue the t command


-- 
使用 Opera 革命性的电子邮件客户程序: http://www.opera.com/mail/

[-- Attachment #2: memory.stat --]
[-- Type: application/octet-stream, Size: 460 bytes --]

cache 0
rss 52473856
mapped_file 0
pgpgin 39296
pgpgout 38749
swap 0
inactive_anon 52473856
active_anon 0
inactive_file 0
active_file 0
unevictable 0
hierarchical_memory_limit 104857600
hierarchical_memsw_limit 1073741824
total_cache 0
total_rss 52473856
total_mapped_file 0
total_pgpgin 39296
total_pgpgout 38749
total_swap 0
total_inactive_anon 52473856
total_active_anon 0
total_inactive_file 0
total_active_file 0
total_unevictable 0

[-- Attachment #3: oom_message.txt --]
[-- Type: text/plain, Size: 6019 bytes --]

Apr 16 11:34:50 localhost kernel: t invoked oom-killer: gfp_mask=0xd0, order=0, oom_adj=0, oom_score_adj=0
Apr 16 11:34:50 localhost kernel: t cpuset=/ mems_allowed=0
Apr 16 11:34:50 localhost kernel: Pid: 15462, comm: t Not tainted 2.6.32-220.7.1.el6.x86_64 #1
Apr 16 11:34:50 localhost kernel: Call Trace:
Apr 16 11:34:50 localhost kernel: [<ffffffff810c2c61>] ? cpuset_print_task_mems_allowed+0x91/0xb0
Apr 16 11:34:50 localhost kernel: [<ffffffff811139e0>] ? dump_header+0x90/0x1b0
Apr 16 11:34:50 localhost kernel: [<ffffffff811693b5>] ? task_in_mem_cgroup+0x35/0xb0
Apr 16 11:34:50 localhost kernel: [<ffffffff8120d7ac>] ? security_real_capable_noaudit+0x3c/0x70
Apr 16 11:34:50 localhost kernel: [<ffffffff81113e6a>] ? oom_kill_process+0x8a/0x2c0
Apr 16 11:34:50 localhost kernel: [<ffffffff81113d5e>] ? select_bad_process+0x9e/0x120
Apr 16 11:34:50 localhost kernel: [<ffffffff81114602>] ? mem_cgroup_out_of_memory+0x92/0xb0
Apr 16 11:34:50 localhost kernel: [<ffffffff81169357>] ? mem_cgroup_handle_oom+0x147/0x170
Apr 16 11:34:50 localhost kernel: [<ffffffff81090a90>] ? autoremove_wake_function+0x0/0x40
Apr 16 11:34:50 localhost kernel: [<ffffffff8116a61b>] ? __mem_cgroup_try_charge+0x3bb/0x420
Apr 16 11:34:50 localhost kernel: [<ffffffff81123851>] ? __alloc_pages_nodemask+0x111/0x940
Apr 16 11:34:50 localhost kernel: [<ffffffff8116b917>] ? mem_cgroup_charge_common+0x87/0xd0
Apr 16 11:34:50 localhost kernel: [<ffffffff8116bae8>] ? mem_cgroup_newpage_charge+0x48/0x50
Apr 16 11:34:50 localhost kernel: [<ffffffff8113beca>] ? handle_pte_fault+0x79a/0xb50
Apr 16 11:34:50 localhost kernel: [<ffffffff810471c7>] ? pte_alloc_one+0x37/0x50
Apr 16 11:34:50 localhost kernel: [<ffffffff81171ad9>] ? do_huge_pmd_anonymous_page+0xb9/0x370
Apr 16 11:34:50 localhost kernel: [<ffffffff8100bc0e>] ? apic_timer_interrupt+0xe/0x20
Apr 16 11:34:50 localhost kernel: [<ffffffff8113c464>] ? handle_mm_fault+0x1e4/0x2b0
Apr 16 11:34:50 localhost kernel: [<ffffffff81042b79>] ? __do_page_fault+0x139/0x480
Apr 16 11:34:50 localhost kernel: [<ffffffff811424ea>] ? do_mmap_pgoff+0x33a/0x380
Apr 16 11:34:50 localhost kernel: [<ffffffff814f253e>] ? do_page_fault+0x3e/0xa0
Apr 16 11:34:50 localhost kernel: [<ffffffff814ef8f5>] ? page_fault+0x25/0x30
Apr 16 11:34:50 localhost kernel: Task in /test killed as a result of limit of /test
Apr 16 11:34:50 localhost kernel: memory: usage 102400kB, limit 102400kB, failcnt 756
Apr 16 11:34:50 localhost kernel: memory+swap: usage 206240kB, limit 1048576kB, failcnt 0
Apr 16 11:34:50 localhost kernel: Mem-Info:
Apr 16 11:34:50 localhost kernel: Node 0 DMA per-cpu:
Apr 16 11:34:50 localhost kernel: CPU    0: hi:    0, btch:   1 usd:   0
Apr 16 11:34:50 localhost kernel: CPU    1: hi:    0, btch:   1 usd:   0
Apr 16 11:34:50 localhost kernel: CPU    2: hi:    0, btch:   1 usd:   0
Apr 16 11:34:50 localhost kernel: CPU    3: hi:    0, btch:   1 usd:   0
Apr 16 11:34:50 localhost kernel: Node 0 DMA32 per-cpu:
Apr 16 11:34:50 localhost kernel: CPU    0: hi:  186, btch:  31 usd:  88
Apr 16 11:34:50 localhost kernel: CPU    1: hi:  186, btch:  31 usd:   0
Apr 16 11:34:50 localhost kernel: CPU    2: hi:  186, btch:  31 usd:   0
Apr 16 11:34:50 localhost kernel: CPU    3: hi:  186, btch:  31 usd:  53
Apr 16 11:34:50 localhost kernel: active_anon:14198 inactive_anon:66406 isolated_anon:0
Apr 16 11:34:50 localhost kernel: active_file:62480 inactive_file:88538 isolated_file:0
Apr 16 11:34:50 localhost kernel: unevictable:0 dirty:0 writeback:12822 unstable:0
Apr 16 11:34:50 localhost kernel: free:27898 slab_reclaimable:8884 slab_unreclaimable:9427
Apr 16 11:34:50 localhost kernel: mapped:2723 shmem:68 pagetables:1747 bounce:0
Apr 16 11:34:50 localhost kernel: Node 0 DMA free:15704kB min:592kB low:740kB high:888kB active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:15308kB mlocked:0kB dirty:0kB writeback:0kB mapped:0kB shmem:0kB slab_reclaimable:0kB slab_unreclaimable:0kB kernel_stack:0kB pagetables:0kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
Apr 16 11:34:50 localhost kernel: lowmem_reserve[]: 0 1120 1120 1120
Apr 16 11:34:50 localhost kernel: Node 0 DMA32 free:95888kB min:44460kB low:55572kB high:66688kB active_anon:56792kB inactive_anon:265624kB active_file:249920kB inactive_file:354152kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:1147232kB mlocked:0kB dirty:0kB writeback:51288kB mapped:10892kB shmem:272kB slab_reclaimable:35536kB slab_unreclaimable:37708kB kernel_stack:2216kB pagetables:6988kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
Apr 16 11:34:50 localhost kernel: lowmem_reserve[]: 0 0 0 0
Apr 16 11:34:50 localhost kernel: Node 0 DMA: 2*4kB 4*8kB 3*16kB 2*32kB 1*64kB 1*128kB 0*256kB 0*512kB 1*1024kB 1*2048kB 3*4096kB = 15704kB
Apr 16 11:34:50 localhost kernel: Node 0 DMA32: 124*4kB 882*8kB 579*16kB 337*32kB 171*64kB 42*128kB 3*256kB 32*512kB 32*1024kB 1*2048kB 0*4096kB = 95888kB
Apr 16 11:34:50 localhost kernel: 211205 total pagecache pages
Apr 16 11:34:50 localhost kernel: 60108 pages in swap cache
Apr 16 11:34:50 localhost kernel: Swap cache stats: add 1240384, delete 1180276, find 400/507
Apr 16 11:34:50 localhost kernel: Free swap  = 1720104kB
Apr 16 11:34:50 localhost kernel: Total swap = 2064376kB
Apr 16 11:34:50 localhost kernel: 294896 pages RAM
Apr 16 11:34:50 localhost kernel: 7632 pages reserved
Apr 16 11:34:50 localhost kernel: 100154 pages shared
Apr 16 11:34:50 localhost kernel: 171738 pages non-shared
Apr 16 11:34:50 localhost kernel: [ pid ]   uid  tgid total_vm      rss cpu oom_adj oom_score_adj name
Apr 16 11:34:50 localhost kernel: [15462]   500 15462    58346    12903   3       0             0 t
Apr 16 11:34:50 localhost kernel: Memory cgroup out of memory: Kill process 15462 (t) score 1000 or sacrifice child
Apr 16 11:34:50 localhost kernel: Killed process 15462, UID 500, (t) total-vm:233384kB, anon-rss:51228kB, file-rss:384kB

[-- Attachment #4: test.c --]
[-- Type: application/octet-stream, Size: 361 bytes --]

#include <stdio.h>
#include <unistd.h>
#define BUF_LEN (1024*1024*32)
int main()
{
	printf("pid= %d \n",getpid());
	getchar();
	int cnt=0;
	while(1)
	{
		char*p=malloc(BUF_LEN);
		if(p==NULL)
		{
			printf("p=NULL\n");
			return 0;
		}
		memset(p,0,BUF_LEN);
		cnt+=BUF_LEN;
		printf("usage: %dk\n",cnt/1024);
		//sleep(1);
	}
	return 0;
}

  reply	other threads:[~2012-04-16  3:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <op.wco7ekvhn27o5l@gaoqiang-d1.corp.qihoo.net>
2012-04-13 14:49 ` Michal Hocko
2012-04-16  3:43   ` gaoqiang [this message]
2012-04-16 14:26     ` Michal Hocko
2012-04-17  3:25     ` Sha Zhengju
2012-04-17  8:18       ` gaoqiang

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=op.wct9zibjn27o5l@gaoqiang-d1.corp.qihoo.net \
    --to=gaoqiangscut@gmail.com \
    --cc=cgroups@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.cz \
    /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