]> git.karo-electronics.de Git - karo-tx-linux.git/commit
memcg: make threshold index in the right position
authorSha Zhengju <handai.szj@taobao.com>
Thu, 12 Apr 2012 22:52:08 +0000 (08:52 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 17 Apr 2012 03:47:22 +0000 (13:47 +1000)
commit323b36197475a97208fde2ae8cf541f3f63f17b7
tree60464000c72913763b408579be5baeadb4c73157
parent40d48ca0800bd7d03dc90d0ed55b0b2ac2a900dd
memcg: make threshold index in the right position

Index current_threshold may point to threshold that just equal to usage
after last call of __mem_cgroup_threshold.  But after registering a new
event, it will change (pointing to threshold just below usage).  So make
it consistent here.

For example:
now:
threshold array:  3  [5]  7  9   (usage = 6, [index] = 5)

next turn (after calling __mem_cgroup_threshold):
threshold array:  3   5  [7]  9   (usage = 7, [index] = 7)

after registering a new event (threshold = 10):
threshold array:  3  [5]  7  9  10 (usage = 7, [index] = 5)

Signed-off-by: Sha Zhengju <handai.szj@taobao.com>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Reviewed-by: Kirill A. Shutemov <kirill@shutemov.name>
Cc: Michal Hocko <mhocko@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/memcontrol.c