Skip to contentSkip to conversation

Exclude PUD/PMD alloc functions if !MMU

PATCH In review David Howells 2 participants 3 messages Jan 4, 2005 – Jan 5, 2005 MM core

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Exclude PUD/PMD alloc functions if !MMU

Don't declare pud_alloc() and pmd_alloc() if a nommu kernel is being compiled. These functions require various things that aren't defined for nommu.

---
warthog>diffstat nommu-exclusions-2610mm1.diff

 mm.h |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)
include/linux/mm.h renamed from warthog/kernels/linux-2.6.10-mm1/include/linux/mm.h +1 -1
diff -uNrp /warthog/kernels/linux-2.6.10-mm1/include/linux/mm.h linux-2.6.10-mm1-frv/include/linux/mm.h
@@ -668,7 +668,7 @@ extern void remove_shrinker(struct shrin
  * The following ifdef needed to get the 4level-fixup.h header to work.
  * Remove it when 4level-fixup.h has been removed.
  */
-#ifndef __ARCH_HAS_4LEVEL_HACK 
+#if defined(CONFIG_MMU) && !defined(__ARCH_HAS_4LEVEL_HACK)
 static inline pud_t *pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address)
 {
 	if (pgd_none(*pgd))
#1 lore raw
Quoted 14 lines · David Howells

Don't declare pud_alloc() and pmd_alloc() if a nommu kernel is being compiled. These functions require various things that aren't defined for nommu.

---
warthog>diffstat nommu-exclusions-2610mm1.diff

 mm.h |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -uNrp /warthog/kernels/linux-2.6.10-mm1/include/linux/mm.h linux-2.6.10-mm1-frv/include/linux/mm.h

include/linux/mm.h extern void remove_shrinker(struct shrin · line 674

Quoted 8 lines
include/linux/mm.h renamed from warthog/kernels/linux-2.6.10-mm1/include/linux/mm.h +1 -1
@@ -668,7 +668,7 @@ extern void remove_shrinker(struct shrin
  * The following ifdef needed to get the 4level-fixup.h header to work.
  * Remove it when 4level-fixup.h has been removed.
  */
-#ifndef __ARCH_HAS_4LEVEL_HACK 
+#if defined(CONFIG_MMU) && !defined(__ARCH_HAS_4LEVEL_HACK)
 static inline pud_t *pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address)
 {
 	if (pgd_none(*pgd))

I think you need to do it in the following way:

#ifdef CONFIG_MMU
#ifndef __ARCH_HAS_4LEVEL_HACK
static inline pud_t *pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address)

{
         if (pgd_none(*pgd))

...
#else /* __ARCH_HAS_4LEVEL_HACK */
...
#endif /* __ARCH_HAS_4LEVEL_HACK */
#endif /* CONFIG_MMU */

No?

#2 lore raw
Quoted 1 line · Nick Piggin

I think you need to do it in the following way:

That works too.

David