From: Balbir Singh <balbir@linux.vnet.ibm.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Greg Thelen <gthelen@google.com>,
lsf10-pc@lists.linuxfoundation.org, linux-mm@kvack.org,
"nishimura@mxp.nes.nec.co.jp" <nishimura@mxp.nes.nec.co.jp>
Subject: Re: [ATTEND][LSF/VM TOPIC] deterministic cgroup charging using file path
Date: Mon, 28 Jun 2010 10:37:23 +0530 [thread overview]
Message-ID: <20100628050723.GR4306@balbir.in.ibm.com> (raw)
In-Reply-To: <20100628110327.8cb51c0e.kamezawa.hiroyu@jp.fujitsu.com>
* KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> [2010-06-28 11:03:27]:
> On Fri, 25 Jun 2010 13:43:45 -0700
> Greg Thelen <gthelen@google.com> wrote:
>
> > For the upcoming Linux VM summit, I am interesting in discussing the
> > following proposal.
> >
> > Problem: When tasks from multiple cgroups share files the charging can be
> > non-deterministic. This requires that all such cgroups have unnecessarily high
> > limits. It would be nice if the charging was deterministic, using the file's
> > path to determine which cgroup to charge. This would benefit charging of
> > commonly used files (eg: libc) as well as large databases shared by only a few
> > tasks.
> >
> > Example: assume two tasks (T1 and T2), each in a separate cgroup. Each task
> > wants to access a large (1GB) database file. To catch memory leaks a tight
> > memory limit on each task's cgroup is set. However, the large database file
> > presents a problem. If the file has not been cached, then the first task to
> > access the file is charged, thereby requiring that task's cgroup to have a limit
> > large enough to include the database file. If the order of access is unknown
> > (due to process restart, etc), then all cgroups accessing the file need to have
> > a limit large enough to include the database. This is wasteful because the
> > database won't be charged to both T1 and T2. It would be useful to introduce
> > determinism by declaring that a particular cgroup is charged for a particular
> > set of files.
> >
> > /dev/cgroup/cg1/cg11 # T1: want memory.limit = 30MB
> > /dev/cgroup/cg1/cg12 # T2: want memory.limit = 100MB
> > /dev/cgroup/cg1 # want memory.limit = 1GB + 30MB + 100MB
> >
> > I have implemented a prototype that allows a file system hierarchy be charge a
> > particular cgroup using a new bind mount option:
> > + mount -t cgroup none /cgroup -o memory
> > + mount --bind /tmp/db /tmp/db -o cgroup=/dev/cgroup/cg1
> >
> > Any accesses to files within /tmp/db are charged to /dev/cgroup/cg1. Access to
> > other files behave normally - they charge the cgroup of the current task.
> >
>
> Interesting, but I want to use madvice() etc..for this kind of jobs, rather than
> deep hooks into the kernel.
>
> madvise(addr, size, MEMORY_RECHAEGE_THIS_PAGES_TO_ME);
>
> Then, you can write a command as:
>
> file_recharge [path name] [cgroup]
> - this commands move a file cache to specified cgroup.
>
> A daemon program which uses this command + inotify will give us much
> flexible controls on file cache on memcg. Do you have some requirements
> that this move-charge shouldn't be done in lazy manner ?
>
> Status:
> We have codes for move-charge, inotify but have no code for new madvise.
I have not see the approach yet, but ideally one would want to avoid
changing the application, otherwise we are going to get very tightly
bound in the API issues.
I want to understand why do we need bind mounts? I think this needs
more discussion.
--
Three Cheers,
Balbir
--
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:[~2010-06-28 5:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-25 20:43 [ATTEND][LSF/VM TOPIC] deterministic cgroup charging using file path Greg Thelen
2010-06-28 2:03 ` KAMEZAWA Hiroyuki
2010-06-28 5:07 ` Balbir Singh [this message]
2010-06-29 6:42 ` Greg Thelen
2010-06-29 5:31 ` [ATTEND][LSF/VM TOPIC] " Greg Thelen
2010-06-29 6:30 ` KAMEZAWA Hiroyuki
2010-07-01 4:16 ` Greg Thelen
2010-07-01 6:33 ` KAMEZAWA Hiroyuki
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=20100628050723.GR4306@balbir.in.ibm.com \
--to=balbir@linux.vnet.ibm.com \
--cc=gthelen@google.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-mm@kvack.org \
--cc=lsf10-pc@lists.linuxfoundation.org \
--cc=nishimura@mxp.nes.nec.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).