summaryrefslogtreecommitdiffstats
path: root/kernel/fork.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/fork.c')
-rw-r--r--kernel/fork.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index 5a0fd518e04e..60763c043aa3 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -125,6 +125,15 @@ int nr_threads; /* The idle threads do not count.. */
125 125
126static int max_threads; /* tunable limit on nr_threads */ 126static int max_threads; /* tunable limit on nr_threads */
127 127
128#define NAMED_ARRAY_INDEX(x) [x] = __stringify(x)
129
130static const char * const resident_page_types[] = {
131 NAMED_ARRAY_INDEX(MM_FILEPAGES),
132 NAMED_ARRAY_INDEX(MM_ANONPAGES),
133 NAMED_ARRAY_INDEX(MM_SWAPENTS),
134 NAMED_ARRAY_INDEX(MM_SHMEMPAGES),
135};
136
128DEFINE_PER_CPU(unsigned long, process_counts) = 0; 137DEFINE_PER_CPU(unsigned long, process_counts) = 0;
129 138
130__cacheline_aligned DEFINE_RWLOCK(tasklist_lock); /* outer */ 139__cacheline_aligned DEFINE_RWLOCK(tasklist_lock); /* outer */
@@ -645,12 +654,15 @@ static void check_mm(struct mm_struct *mm)
645{ 654{
646 int i; 655 int i;
647 656
657 BUILD_BUG_ON_MSG(ARRAY_SIZE(resident_page_types) != NR_MM_COUNTERS,
658 "Please make sure 'struct resident_page_types[]' is updated as well");
659
648 for (i = 0; i < NR_MM_COUNTERS; i++) { 660 for (i = 0; i < NR_MM_COUNTERS; i++) {
649 long x = atomic_long_read(&mm->rss_stat.count[i]); 661 long x = atomic_long_read(&mm->rss_stat.count[i]);
650 662
651 if (unlikely(x)) 663 if (unlikely(x))
652 printk(KERN_ALERT "BUG: Bad rss-counter state " 664 pr_alert("BUG: Bad rss-counter state mm:%p type:%s val:%ld\n",
653 "mm:%p idx:%d val:%ld\n", mm, i, x); 665 mm, resident_page_types[i], x);
654 } 666 }
655 667
656 if (mm_pgtables_bytes(mm)) 668 if (mm_pgtables_bytes(mm))