* [PATCH] memcg,thp: fix res_counter:96 regression
@ 2012-05-18 18:28 Hugh Dickins
2012-05-21 10:26 ` KAMEZAWA Hiroyuki
0 siblings, 1 reply; 2+ messages in thread
From: Hugh Dickins @ 2012-05-18 18:28 UTC (permalink / raw)
To: Linus Torvalds
Cc: Andrew Morton, Naoya Horiguchi, KAMEZAWA Hiroyuki,
Andrea Arcangeli, David Rientjes, linux-mm, linux-kernel
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 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>
---
mm/memcontrol.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- 3.4-rc7/mm/memcontrol.c 2012-05-12 22:56:05.340002552 -0700
+++ linux/mm/memcontrol.c 2012-05-17 09:39:45.944034396 -0700
@@ -5481,7 +5481,7 @@ static int mem_cgroup_move_charge_pte_ra
* part of thp split is not executed yet.
*/
if (pmd_trans_huge_lock(pmd, vma) == 1) {
- if (!mc.precharge) {
+ if (mc.precharge < HPAGE_PMD_NR) {
spin_unlock(&vma->vm_mm->page_table_lock);
return 0;
}
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] memcg,thp: fix res_counter:96 regression
2012-05-18 18:28 [PATCH] memcg,thp: fix res_counter:96 regression Hugh Dickins
@ 2012-05-21 10:26 ` KAMEZAWA Hiroyuki
0 siblings, 0 replies; 2+ messages in thread
From: KAMEZAWA Hiroyuki @ 2012-05-21 10:26 UTC (permalink / raw)
To: Hugh Dickins
Cc: Linus Torvalds, Andrew Morton, Naoya Horiguchi, Andrea Arcangeli,
David Rientjes, linux-mm, linux-kernel
(2012/05/19 3:28), Hugh Dickins wrote:
> 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 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>
Thank you.
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-05-21 10:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-18 18:28 [PATCH] memcg,thp: fix res_counter:96 regression Hugh Dickins
2012-05-21 10:26 ` KAMEZAWA Hiroyuki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox