Hugh Dickins 62ade86ab6 memcg,thp: fix res_counter:96 regression
Occasionally, testing memcg's move_charge_at_immigrate on rc7 shows
a flurry of hundreds of warnings at kernel/res_counter.c:96, where
res_counter_uncharge_locked() does WARN_ON(counter->usage < val).

The first trace of each flurry implicates __mem_cgroup_cancel_charge()
of mc.precharge, and an audit of mc.precharge handling points to
mem_cgroup_move_charge_pte_range()'s THP handling in commit 12724850e806
("memcg: avoid THP split in task migration").

Checking !mc.precharge is good everywhere else, when a single page is to
be charged; but here the "mc.precharge -= HPAGE_PMD_NR" likely to
follow, is liable to result in underflow (a lot can change since the
precharge was estimated).

Simply check against HPAGE_PMD_NR: there's probably a better
alternative, trying precharge for more, splitting if unsuccessful; but
this one-liner is safer for now - no kernel/res_counter.c:96 warnings
seen in 26 hours.

Signed-off-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-05-19 10:10:27 -07:00
..
2012-01-03 22:54:56 -05:00
2011-07-26 16:49:47 -07:00
2011-11-02 16:06:57 -07:00
2011-10-31 17:30:44 -07:00
2012-03-23 16:58:42 -07:00
2012-04-21 01:58:20 -04:00
2010-05-21 18:31:21 -04:00
2012-04-21 01:58:20 -04:00
2011-03-10 08:52:27 +01:00
2012-01-20 09:23:16 -08:00
2011-05-20 12:50:29 -07:00
2011-10-31 17:30:50 -07:00
2012-04-25 21:26:33 -07:00
2012-04-25 21:26:33 -07:00