diff options
author | KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> | 2009-10-01 18:44:11 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-10-01 19:11:13 -0400 |
commit | 4e649152cbaa1aedd01821d200ab9d597fe469e4 (patch) | |
tree | 635fa7d75acda929e81b8b0db7e641b7d4e07b35 /include/linux/res_counter.h | |
parent | 3dece8347df6a16239fab10dadb370854f1c969c (diff) |
memcg: some modification to softlimit under hierarchical memory reclaim.
This patch clean up/fixes for memcg's uncharge soft limit path.
Problems:
Now, res_counter_charge()/uncharge() handles softlimit information at
charge/uncharge and softlimit-check is done when event counter per memcg
goes over limit. Now, event counter per memcg is updated only when
memory usage is over soft limit. Here, considering hierarchical memcg
management, ancesotors should be taken care of.
Now, ancerstors(hierarchy) are handled in charge() but not in uncharge().
This is not good.
Prolems:
1. memcg's event counter incremented only when softlimit hits. That's bad.
It makes event counter hard to be reused for other purpose.
2. At uncharge, only the lowest level rescounter is handled. This is bug.
Because ancesotor's event counter is not incremented, children should
take care of them.
3. res_counter_uncharge()'s 3rd argument is NULL in most case.
ops under res_counter->lock should be small. No "if" sentense is better.
Fixes:
* Removed soft_limit_xx poitner and checks in charge and uncharge.
Do-check-only-when-necessary scheme works enough well without them.
* make event-counter of memcg incremented at every charge/uncharge.
(per-cpu area will be accessed soon anyway)
* All ancestors are checked at soft-limit-check. This is necessary because
ancesotor's event counter may never be modified. Then, they should be
checked at the same time.
Reviewed-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Paul Menage <menage@google.com>
Cc: Li Zefan <lizf@cn.fujitsu.com>
Cc: Balbir Singh <balbir@in.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/res_counter.h')
-rw-r--r-- | include/linux/res_counter.h | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h index 731af71cddc9..fcb9884df618 100644 --- a/include/linux/res_counter.h +++ b/include/linux/res_counter.h | |||
@@ -114,8 +114,7 @@ void res_counter_init(struct res_counter *counter, struct res_counter *parent); | |||
114 | int __must_check res_counter_charge_locked(struct res_counter *counter, | 114 | int __must_check res_counter_charge_locked(struct res_counter *counter, |
115 | unsigned long val); | 115 | unsigned long val); |
116 | int __must_check res_counter_charge(struct res_counter *counter, | 116 | int __must_check res_counter_charge(struct res_counter *counter, |
117 | unsigned long val, struct res_counter **limit_fail_at, | 117 | unsigned long val, struct res_counter **limit_fail_at); |
118 | struct res_counter **soft_limit_at); | ||
119 | 118 | ||
120 | /* | 119 | /* |
121 | * uncharge - tell that some portion of the resource is released | 120 | * uncharge - tell that some portion of the resource is released |
@@ -128,8 +127,7 @@ int __must_check res_counter_charge(struct res_counter *counter, | |||
128 | */ | 127 | */ |
129 | 128 | ||
130 | void res_counter_uncharge_locked(struct res_counter *counter, unsigned long val); | 129 | void res_counter_uncharge_locked(struct res_counter *counter, unsigned long val); |
131 | void res_counter_uncharge(struct res_counter *counter, unsigned long val, | 130 | void res_counter_uncharge(struct res_counter *counter, unsigned long val); |
132 | bool *was_soft_limit_excess); | ||
133 | 131 | ||
134 | static inline bool res_counter_limit_check_locked(struct res_counter *cnt) | 132 | static inline bool res_counter_limit_check_locked(struct res_counter *cnt) |
135 | { | 133 | { |