memcg: rework usage of stats by soft limit
memcg: rework usage of stats by soft limit

Instead of incrementing counter on each page in/out and comparing it with
constant, we set counter to constant, decrement counter on each page
in/out and compare it with zero.  We want to make comparing as fast as
possible.  On many RISC systems (probably not only RISC) comparing with
zero is more effective than comparing with a constant, since not every
constant can be immediate operand for compare instruction.

Also, I've renamed MEM_CGROUP_STAT_EVENTS to MEM_CGROUP_STAT_SOFTLIMIT,
since really it's not a generic counter.

Signed-off-by: Kirill A. Shutemov <9b153e80bc985b32d577460a8a24e398d4182978@shutemov.name>
Cc: Li Zefan <5dc16b054e85ffba6c8d314d8e55ae95dcab12a5@cn.fujitsu.com>
Cc: KAMEZAWA Hiroyuki <634f508bd7c47cf0ee4126243675c3e598920fbc@jp.fujitsu.com>
Cc: Balbir Singh <65a1aed538f36fed73d8c45e9ddfc585ce9f4abf@linux.vnet.ibm.com>
Cc: Pavel Emelyanov <c9a32589e048e044184536f7ac71ef92fe82df3e@openvz.org>
Cc: Dan Malek <2591e5f46f28d303f9dc027d475a5c60d8dea17a@embeddedalley.com>
Cc: Vladislav Buzov <be026bff6b8fee99b506e1fcdca4189eab42dd6b@embeddedalley.com>
Cc: Daisuke Nishimura <d7ce9d9454f80efacebffaaa82023b8c983997f5@mxp.nes.nec.co.jp>
Cc: Alexander Shishkin <ad427779d5c7c816b5649657d7449a50ef7f9847@slind.org>
Cc: Davide Libenzi <91df8000b8dca80eb036dde93edf593d4a91414e@xmailserver.org>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

KristFoundation/Programs,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,KristFoundation/Programs