linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] mm: add rss counters consistency check
@ 2012-01-06 17:38 Konstantin Khlebnikov
  2012-01-06 17:38 ` [PATCH 2/3] mm: postpone migrated page mapping reset Konstantin Khlebnikov
  2012-01-06 17:38 ` [PATCH 3/3] mm: adjust rss counters for migration entiries Konstantin Khlebnikov
  0 siblings, 2 replies; 12+ messages in thread
From: Konstantin Khlebnikov @ 2012-01-06 17:38 UTC (permalink / raw)
  To: Andrew Morton, Hugh Dickins, KAMEZAWA Hiroyuki; +Cc: linux-mm, linux-kernel

This patch warn about non-zero rss counters at final mmdrop.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
---
 kernel/fork.c |   21 ++++++++++++++++++---
 1 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/kernel/fork.c b/kernel/fork.c
index da4a6a1..67a79dd 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -507,6 +507,23 @@ static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p)
 	return NULL;
 }
 
+static void check_mm(struct mm_struct *mm)
+{
+	int i;
+
+	for (i = 0; i < NR_MM_COUNTERS; i++) {
+		long x = atomic_long_read(&mm->rss_stat.count[i]);
+
+		if (unlikely(x))
+			printk(KERN_ALERT "BUG: Bad rss-counter state "
+					  "mm:%p idx:%d val:%ld\n", mm, i, x);
+	}
+
+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
+	VM_BUG_ON(mm->pmd_huge_pte);
+#endif
+}
+
 /*
  * Allocate and initialize an mm_struct.
  */
@@ -534,9 +551,7 @@ void __mmdrop(struct mm_struct *mm)
 	mm_free_pgd(mm);
 	destroy_context(mm);
 	mmu_notifier_mm_destroy(mm);
-#ifdef CONFIG_TRANSPARENT_HUGEPAGE
-	VM_BUG_ON(mm->pmd_huge_pte);
-#endif
+	check_mm(mm);
 	free_mm(mm);
 }
 EXPORT_SYMBOL_GPL(__mmdrop);


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2012-01-26  0:20 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-06 17:38 [PATCH 1/3] mm: add rss counters consistency check Konstantin Khlebnikov
2012-01-06 17:38 ` [PATCH 2/3] mm: postpone migrated page mapping reset Konstantin Khlebnikov
2012-01-06 17:38 ` [PATCH 3/3] mm: adjust rss counters for migration entiries Konstantin Khlebnikov
2012-01-06 17:45   ` Konstantin Khlebnikov
2012-01-11  5:41   ` KAMEZAWA Hiroyuki
2012-01-11  8:23     ` Konstantin Khlebnikov
2012-01-11  8:41       ` KAMEZAWA Hiroyuki
2012-01-18 23:21         ` Andrew Morton
2012-01-24  1:42           ` Hugh Dickins
2012-01-24  7:08             ` Konstantin Khlebnikov
2012-01-25 23:01               ` Hugh Dickins
2012-01-26  0:20                 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).