Subject: linux-next: build failure after merge of the akpm-current tree

From: Stephen Rothwell <[email-masked]>
Date: Mon, 19 Jan 2015 19:17:18 +1100

Hi Andrew,

After merging the akpm tree, today's linux-next build (sparc defconfig)
failed like this:

In file included from arch/sparc/include/asm/bug.h:20:0,
                 from include/linux/bug.h:4,
                 from include/linux/thread_info.h:11,
                 from include/asm-generic/preempt.h:4,
                 from arch/sparc/include/generated/asm/preempt.h:1,
                 from include/linux/preempt.h:18,
                 from include/linux/spinlock.h:50,
                 from include/linux/mmzone.h:7,
                 from include/linux/gfp.h:5,
                 from include/linux/slab.h:14,
                 from mm/mmap.c:12:
mm/mmap.c: In function 'exit_mmap':
mm/mmap.c:2858:46: error: 'PUD_SHIFT' undeclared (first use in this function)
    round_up(FIRST_USER_ADDRESS, PUD_SIZE) >> PUD_SHIFT);
                                              ^
include/asm-generic/bug.h:86:25: note: in definition of macro 'WARN_ON'
  int __ret_warn_on = !!(condition);    \
                         ^
mm/mmap.c:2858:46: note: each undeclared identifier is reported only once for each function it appears in
    round_up(FIRST_USER_ADDRESS, PUD_SIZE) >> PUD_SHIFT);
                                              ^
include/asm-generic/bug.h:86:25: note: in definition of macro 'WARN_ON'
  int __ret_warn_on = !!(condition);    \
                         ^

Caused by commit b316feb3c37f ("mm: account pmd page tables to the
process").  32 bit sparc does not seem to define PUD_SHIFT ...

I am not sure what the correct fix is here, so I just did the following
patch for today.

From: Stephen Rothwell <[email-masked]>
Date: Mon, 19 Jan 2015 19:10:53 +1100
Subject: [PATCH] mm: account pmd page tables to the process fix

Signed-off-by: Stephen Rothwell <[email-masked]>
---
 mm/mmap.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/mmap.c b/mm/mmap.c
index 6a7d36d133fb..25271805ab39 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2854,8 +2854,10 @@ void exit_mmap(struct mm_struct *mm)
 
 	WARN_ON(atomic_long_read(&mm->nr_ptes) >
 			round_up(FIRST_USER_ADDRESS, PMD_SIZE) >> PMD_SHIFT);
+#ifdef PUD_SHIFT
 	WARN_ON(mm_nr_pmds(mm) >
 			round_up(FIRST_USER_ADDRESS, PUD_SIZE) >> PUD_SHIFT);
+#endif
 }
 
 /* Insert vm structure into process list sorted by address
-- 
2.1.4

-- 
Cheers,
Stephen Rothwell                    [email-masked]