linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -mmotm 0/5] memcg: per cgroup dirty limit (v7)
@ 2010-03-14 23:26 Andrea Righi
  2010-03-14 23:26 ` [PATCH -mmotm 1/5] memcg: disable irq at page cgroup lock Andrea Righi
                   ` (7 more replies)
  0 siblings, 8 replies; 68+ messages in thread
From: Andrea Righi @ 2010-03-14 23:26 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki, Daisuke Nishimura, Balbir Singh
  Cc: Vivek Goyal, Peter Zijlstra, Trond Myklebust, Suleiman Souhlal,
	Greg Thelen, Kirill A. Shutemov, Andrew Morton, containers,
	linux-kernel, linux-mm

Control the maximum amount of dirty pages a cgroup can have at any given time.

Per cgroup dirty limit is like fixing the max amount of dirty (hard to reclaim)
page cache used by any cgroup. So, in case of multiple cgroup writers, they
will not be able to consume more than their designated share of dirty pages and
will be forced to perform write-out if they cross that limit.

The overall design is the following:

 - account dirty pages per cgroup
 - limit the number of dirty pages via memory.dirty_ratio / memory.dirty_bytes
   and memory.dirty_background_ratio / memory.dirty_background_bytes in
   cgroupfs
 - start to write-out (background or actively) when the cgroup limits are
   exceeded

This feature is supposed to be strictly connected to any underlying IO
controller implementation, so we can stop increasing dirty pages in VM layer
and enforce a write-out before any cgroup will consume the global amount of
dirty pages defined by the /proc/sys/vm/dirty_ratio|dirty_bytes and
/proc/sys/vm/dirty_background_ratio|dirty_background_bytes limits.

Changelog (v6 -> v7)
~~~~~~~~~~~~~~~~~~~~~~
 * introduce trylock_page_cgroup() to guarantee that lock_page_cgroup()
   is never called under tree_lock (no strict accounting, but better overall
   performance)
 * do not account file cache statistics for the root cgroup (zero
   overhead for the root cgroup)
 * fix: evaluate cgroup free pages as at the minimum free pages of all
   its parents

Results
~~~~~~~
The testcase is a kernel build (2.6.33 x86_64_defconfig) on a Intel Core 2 @
1.2GHz:

<before>
 - root  cgroup:	11m51.983s
 - child cgroup:	11m56.596s

<after>
 - root cgroup:		11m51.742s
 - child cgroup:	12m5.016s

In the previous version of this patchset, using the "complex" locking scheme
with the _locked and _unlocked version of mem_cgroup_update_page_stat(), the
child cgroup required 11m57.896s and 12m9.920s with lock_page_cgroup()+irq_disabled.

With this version there's no overhead for the root cgroup (the small difference
is in error range). I expected to see less overhead for the child cgroup, I'll
do more testing and try to figure better what's happening.

In the while, it would be great if someone could perform some tests on a larger
system... unfortunately at the moment I don't have a big system available for
this kind of tests...

Thanks,
-Andrea

 Documentation/cgroups/memory.txt |   36 +++
 fs/nfs/write.c                   |    4 +
 include/linux/memcontrol.h       |   87 ++++++-
 include/linux/page_cgroup.h      |   35 +++
 include/linux/writeback.h        |    2 -
 mm/filemap.c                     |    1 +
 mm/memcontrol.c                  |  542 +++++++++++++++++++++++++++++++++++---
 mm/page-writeback.c              |  215 ++++++++++------
 mm/rmap.c                        |    4 +-
 mm/truncate.c                    |    1 +
 10 files changed, 806 insertions(+), 121 deletions(-)

--
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>

^ permalink raw reply	[flat|nested] 68+ messages in thread

end of thread, other threads:[~2010-04-24 15:53 UTC | newest]

Thread overview: 68+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-14 23:26 [PATCH -mmotm 0/5] memcg: per cgroup dirty limit (v7) Andrea Righi
2010-03-14 23:26 ` [PATCH -mmotm 1/5] memcg: disable irq at page cgroup lock Andrea Righi
2010-03-15  0:06   ` KAMEZAWA Hiroyuki
2010-03-15 10:00     ` Andrea Righi
2010-03-17  7:04   ` Balbir Singh
2010-03-17 11:58   ` Balbir Singh
2010-03-17 23:54     ` KAMEZAWA Hiroyuki
2010-03-18  0:45       ` KAMEZAWA Hiroyuki
2010-03-18  2:16         ` Daisuke Nishimura
2010-03-18  2:58           ` KAMEZAWA Hiroyuki
2010-03-18  5:12           ` Balbir Singh
2010-03-18  4:19       ` Balbir Singh
2010-03-18  4:21         ` KAMEZAWA Hiroyuki
2010-03-18  6:25           ` Balbir Singh
2010-03-18  4:35         ` KAMEZAWA Hiroyuki
2010-03-18 16:28           ` Balbir Singh
2010-03-19  1:23             ` KAMEZAWA Hiroyuki
2010-03-19  2:40               ` Balbir Singh
2010-03-19  3:00                 ` KAMEZAWA Hiroyuki
     [not found]                   ` <xr93hbnepmj6.fsf@ninji.mtv.corp.google.com>
2010-04-14  6:55                     ` Greg Thelen
2010-04-14  9:29                       ` KAMEZAWA Hiroyuki
2010-04-14 14:04                         ` Vivek Goyal
2010-04-14 19:31                           ` Greg Thelen
2010-04-15  0:14                           ` KAMEZAWA Hiroyuki
2010-04-14 16:22                         ` Greg Thelen
2010-04-15  0:22                           ` KAMEZAWA Hiroyuki
2010-04-14 14:05                       ` Vivek Goyal
2010-04-14 20:14                         ` Greg Thelen
2010-04-15  2:40                           ` Daisuke Nishimura
2010-04-15  4:48                             ` Greg Thelen
2010-04-15  6:21                               ` Daisuke Nishimura
2010-04-15  6:38                                 ` Greg Thelen
2010-04-15  6:54                                 ` KAMEZAWA Hiroyuki
2010-04-23 20:17                                   ` Greg Thelen
2010-04-23 20:54                                     ` Peter Zijlstra
2010-04-24 15:53                                       ` Greg Thelen
2010-04-23 20:57                                     ` Peter Zijlstra
2010-04-24  2:22                                       ` KAMEZAWA Hiroyuki
2010-04-23 21:19                                     ` Peter Zijlstra
2010-04-24  2:19                                     ` KAMEZAWA Hiroyuki
2010-04-14 14:44                       ` Balbir Singh
2010-03-14 23:26 ` [PATCH -mmotm 2/5] memcg: dirty memory documentation Andrea Righi
2010-03-16  7:41   ` Daisuke Nishimura
2010-03-17 17:48     ` Greg Thelen
2010-03-17 19:02       ` Balbir Singh
2010-03-17 22:43     ` Andrea Righi
2010-03-14 23:26 ` [PATCH -mmotm 3/5] page_cgroup: introduce file cache flags Andrea Righi
2010-03-14 23:26 ` [PATCH -mmotm 4/5] memcg: dirty pages accounting and limiting infrastructure Andrea Righi
2010-03-15  2:26   ` KAMEZAWA Hiroyuki
2010-03-16  2:32   ` Daisuke Nishimura
2010-03-16 14:11     ` Vivek Goyal
2010-03-16 15:09       ` Daisuke Nishimura
2010-03-17 22:37       ` Andrea Righi
2010-03-17 22:52     ` Andrea Righi
2010-03-18  6:48   ` Greg Thelen
2010-03-14 23:26 ` [PATCH -mmotm 5/5] memcg: dirty pages instrumentation Andrea Righi
2010-03-15  2:31   ` KAMEZAWA Hiroyuki
2010-03-15  2:36 ` [PATCH -mmotm 0/5] memcg: per cgroup dirty limit (v7) KAMEZAWA Hiroyuki
2010-03-15 10:02   ` Andrea Righi
2010-03-15 17:12 ` Vivek Goyal
2010-03-15 17:19   ` Vivek Goyal
2010-03-17 11:54     ` Balbir Singh
2010-03-17 13:34       ` Vivek Goyal
2010-03-17 18:53         ` Balbir Singh
2010-03-17 19:15           ` Vivek Goyal
2010-03-17 19:17         ` Balbir Singh
2010-03-17 19:48           ` Vivek Goyal
2010-03-17  6:44 ` Balbir Singh

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).