There has been a long-standing wart in linux/swap.h where it uses page_cache_release and release_pages without declaring them by including linux/pagemap.h. There is this scary comment to warn off anyone foolish enough to try to fix this: /* only sparc can not include linux/pagemap.h in this file * so leave page_cache_release and release_pages undeclared... */ This has caused problems for a number of people including: akpm - http://www.ussg.iu.edu/hypermail/linux/kernel/0708.3/0446.html "Oh that damn thing again. It's a regular source of include breakage." ppc - http://patchwork.ozlabs.org/linuxppc/patch?id=12288 UML - http://www.mail-archive.com/user-mode-linux-devel@lists.sourceforge.net/msg05095.html What happens with sparc, when this include is added, is a linux/mm.h -> linux/mm.h recursion: linux/mm.h -> asm/pgtable.h -> linux/swap.h -> linux/pagemap.h -> linux/highmem.h -> linux/mm.h leaving various things that live in mm.h undefined in highmem.h. sparc is unique in the asm/pgtable.h -> linux/swap.h inclusion. This looks correct, as pgtable.h uses swp_entry_t, which is defined in swap.h, so maybe the other arches should do the same. Adding this to the UML pgtable.h causes the same build breakage. All of the links in the recursion above look reasonable, except for linux/pagemap.h -> linux/highmem.h, which is the point of attack for this fix. This series starts off with a trivial fix to asm-generic/futex.h to fix a compile failure that is exposed by the second patch. The second patch removes the inclusion of highmem.h from pagemap.h and cleans up the debris. The third patch adds the linux/swap.h -> linux/pagemap.h inclusion and removes the scary comment. The fourth adds the asm/pgtable.h -> linux/swap.h inclusion for UML. This patch: Upgrade the asm/uaccess.h include to linux/uaccess.h to get declarations for pagefault_disable and pagefault_enable. Signed-off-by: Jeff Dike --- include/asm-generic/futex.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: linux-2.6.17/include/asm-generic/futex.h =================================================================== --- linux-2.6.17.orig/include/asm-generic/futex.h 2007-10-29 11:45:35.000000000 -0400 +++ linux-2.6.17/include/asm-generic/futex.h 2007-10-29 13:20:15.000000000 -0400 @@ -4,8 +4,8 @@ #ifdef __KERNEL__ #include +#include #include -#include static inline int futex_atomic_op_inuser (int encoded_op, int __user *uaddr) Index: linux-2.6.17/include/asm-x86/futex_32.h =================================================================== --- linux-2.6.17.orig/include/asm-x86/futex_32.h 2007-10-29 11:45:35.000000000 -0400 +++ linux-2.6.17/include/asm-x86/futex_32.h 2007-10-29 13:20:15.000000000 -0400 @@ -4,10 +4,10 @@ #ifdef __KERNEL__ #include +#include #include #include #include -#include #define __futex_atomic_op1(insn, ret, oldval, uaddr, oparg) \ __asm__ __volatile ( \ Index: linux-2.6.17/include/asm-x86/futex_64.h =================================================================== --- linux-2.6.17.orig/include/asm-x86/futex_64.h 2007-10-29 11:45:35.000000000 -0400 +++ linux-2.6.17/include/asm-x86/futex_64.h 2007-10-29 13:20:15.000000000 -0400 @@ -4,9 +4,9 @@ #ifdef __KERNEL__ #include +#include #include #include -#include #define __futex_atomic_op1(insn, ret, oldval, uaddr, oparg) \ __asm__ __volatile ( \ Index: linux-2.6.17/include/asm-ia64/futex.h =================================================================== --- linux-2.6.17.orig/include/asm-ia64/futex.h 2007-02-05 17:12:16.000000000 -0500 +++ linux-2.6.17/include/asm-ia64/futex.h 2007-10-29 13:24:22.000000000 -0400 @@ -2,9 +2,9 @@ #define _ASM_FUTEX_H #include +#include #include #include -#include #define __futex_atomic_op1(insn, ret, oldval, uaddr, oparg) \ do { \