diff options
author | Sha Zhengju <[email protected]> | 2013-09-12 15:13:53 -0700 |
---|---|---|
committer | Linus Torvalds <[email protected]> | 2013-09-12 15:38:02 -0700 |
commit | 3ea67d06e4679a16f69f66f43a8d6ee4778985fc (patch) | |
tree | 0ec35a312de85ce91bf0bf6e4c5b88440f3d0f1d /net/lapb/lapb_iface.c | |
parent | 658b72c5a7a033f0dde61b15dff86bf423ce425e (diff) |
memcg: add per cgroup writeback pages accounting
Add memcg routines to count writeback pages, later dirty pages will also
be accounted.
After Kame's commit 89c06bd52fb9 ("memcg: use new logic for page stat
accounting"), we can use 'struct page' flag to test page state instead
of per page_cgroup flag. But memcg has a feature to move a page from a
cgroup to another one and may have race between "move" and "page stat
accounting". So in order to avoid the race we have designed a new lock:
mem_cgroup_begin_update_page_stat()
modify page information -->(a)
mem_cgroup_update_page_stat() -->(b)
mem_cgroup_end_update_page_stat()
It requires both (a) and (b)(writeback pages accounting) to be pretected
in mem_cgroup_{begin/end}_update_page_stat(). It's full no-op for
!CONFIG_MEMCG, almost no-op if memcg is disabled (but compiled in), rcu
read lock in the most cases (no task is moving), and spin_lock_irqsave
on top in the slow path.
There're two writeback interfaces to modify: test_{clear/set}_page_writeback().
And the lock order is:
--> memcg->move_lock
--> mapping->tree_lock
Signed-off-by: Sha Zhengju <[email protected]>
Acked-by: Michal Hocko <[email protected]>
Reviewed-by: Greg Thelen <[email protected]>
Cc: Fengguang Wu <[email protected]>
Cc: KAMEZAWA Hiroyuki <[email protected]>
Cc: Johannes Weiner <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'net/lapb/lapb_iface.c')
0 files changed, 0 insertions, 0 deletions