linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
To: balbir@linux.vnet.ibm.com
Cc: linux-mm <linux-mm@kvack.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Li Zefan <lizf@cn.fujitsu.com>, Paul Menage <menage@google.com>,
	Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Subject: Re: [PATCH -mmotm 4/5] memcg: avoid oom during recharge at task move
Date: Fri, 27 Nov 2009 13:58:10 +0900	[thread overview]
Message-ID: <20091127135810.ef5fee0b.nishimura@mxp.nes.nec.co.jp> (raw)
In-Reply-To: <20091124114358.80e0cafe.nishimura@mxp.nes.nec.co.jp>

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

> > Sorry, if I missed it, but I did not see any time overhead of moving a
> > task after these changes. Could you please help me understand the cost
> > of moving say a task with 1G anonymous memory to another group and
> > the cost of moving a task with 512MB anonymous and 512 page cache
> > mapped, etc. It would be nice to understand the overall cost.
> > 
> O.K.
> I'll test programs with big anonymous pages and measure the time and report.
> 
I measured the elapsed time of "echo <pid> > <some path>/tasks" on KVM guest
with 4CPU/4GB(Xeon/3GHz).

- used the attached simple program.
- made 2 directories(00, 01) under root, and enabled recharge_at_immigrate in both.
- measured the elapsed time by "time -p" for moving between:

  (1) root -> 00
  (2) 00 -> 01

  we don't need to call res_counter_uncharge against root, so (1) would be smaller
  than (2).

  (3) 00(setting mem.limit to half size of total) -> 01

  To compare the overhead of anon and swap.

Results:

       |  252M  |  512M  |   1G
  -----+--------+--------+--------
   (1) |  0.21  |  0.41  |  0.821
  -----+--------+--------+--------
   (2) |  0.43  |  0.85  |  1.71
  -----+--------+--------+--------
   (3) |  0.40  |  0.81  |  1.62
  -----+--------+--------+--------


hmm, it would be better to add some comments to memory.txt like:

  Note: It may take several seconds if you move charges in giga bytes order.


Regards,
Daisuke Nishimura.


[-- Attachment #2: bigmem.c --]
[-- Type: text/x-csrc, Size: 660 bytes --]

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <sys/mman.h>
#include <unistd.h>

void
usage(void)
{
	fprintf(stderr, "bigmem <anon size(MB)>\n");
}

int
main(int argc, char *argv[])
{
	void *buf;
	size_t size;
	pid_t pid;

	if (argc != 2) {
		usage();
		return 1;
	}

	pid = getpid();
	fprintf(stdout, "pid is %d\n", pid);

	size = atol(argv[1]) * 1024 * 1024;
	buf = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
	if (buf == MAP_FAILED) {
		perror(NULL);
		return errno;
	}

	memset(buf, 0, size);
	fprintf(stdout, "allocated %ld bytes anonymous memory\n");

	pause();
}


  reply	other threads:[~2009-11-27  5:02 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-19  4:27 [PATCH -mmotm 0/5] memcg: recharge at task move (19/Nov) Daisuke Nishimura
2009-11-19  4:28 ` [PATCH -mmotm 1/5] cgroup: introduce cancel_attach() Daisuke Nishimura
2009-11-19 21:42   ` Paul Menage
2009-11-19 23:49     ` Daisuke Nishimura
2009-11-19  4:29 ` [PATCH -mmotm 2/5] memcg: add interface to recharge at task move Daisuke Nishimura
2009-11-20 15:42   ` Balbir Singh
2009-11-23 23:56     ` Daisuke Nishimura
2009-11-19  4:29 ` [PATCH -mmotm 3/5] memcg: recharge charges of anonymous page Daisuke Nishimura
2009-11-19  4:30 ` [PATCH -mmotm 4/5] memcg: avoid oom during recharge at task move Daisuke Nishimura
2009-11-23  5:10   ` Balbir Singh
2009-11-24  2:43     ` Daisuke Nishimura
2009-11-27  4:58       ` Daisuke Nishimura [this message]
2009-12-03  4:58         ` Daisuke Nishimura
2009-12-03  5:22           ` KAMEZAWA Hiroyuki
2009-12-03  6:00             ` Daisuke Nishimura
2009-12-03  7:40               ` KAMEZAWA Hiroyuki
2009-11-19  4:31 ` [PATCH -mmotm 5/5] memcg: recharge charges of anonymous swap Daisuke Nishimura
2009-11-23  6:59   ` Balbir Singh
2009-11-24  7:54     ` Daisuke Nishimura
2009-11-19 19:03 ` [PATCH -mmotm 0/5] memcg: recharge at task move (19/Nov) 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=20091127135810.ef5fee0b.nishimura@mxp.nes.nec.co.jp \
    --to=nishimura@mxp.nes.nec.co.jp \
    --cc=akpm@linux-foundation.org \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-mm@kvack.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=menage@google.com \
    /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