kernel-fxtec-pro1x/arch/ia64/include/asm
KAMEZAWA Hiroyuki f2dbcfa738 mm: clean up for early_pfn_to_nid()
What's happening is that the assertion in mm/page_alloc.c:move_freepages()
is triggering:

	BUG_ON(page_zone(start_page) != page_zone(end_page));

Once I knew this is what was happening, I added some annotations:

	if (unlikely(page_zone(start_page) != page_zone(end_page))) {
		printk(KERN_ERR "move_freepages: Bogus zones: "
		       "start_page[%p] end_page[%p] zone[%p]\n",
		       start_page, end_page, zone);
		printk(KERN_ERR "move_freepages: "
		       "start_zone[%p] end_zone[%p]\n",
		       page_zone(start_page), page_zone(end_page));
		printk(KERN_ERR "move_freepages: "
		       "start_pfn[0x%lx] end_pfn[0x%lx]\n",
		       page_to_pfn(start_page), page_to_pfn(end_page));
		printk(KERN_ERR "move_freepages: "
		       "start_nid[%d] end_nid[%d]\n",
		       page_to_nid(start_page), page_to_nid(end_page));
 ...

And here's what I got:

	move_freepages: Bogus zones: start_page[2207d0000] end_page[2207dffc0] zone[fffff8103effcb00]
	move_freepages: start_zone[fffff8103effcb00] end_zone[fffff8003fffeb00]
	move_freepages: start_pfn[0x81f600] end_pfn[0x81f7ff]
	move_freepages: start_nid[1] end_nid[0]

My memory layout on this box is:

[    0.000000] Zone PFN ranges:
[    0.000000]   Normal   0x00000000 -> 0x0081ff5d
[    0.000000] Movable zone start PFN for each node
[    0.000000] early_node_map[8] active PFN ranges
[    0.000000]     0: 0x00000000 -> 0x00020000
[    0.000000]     1: 0x00800000 -> 0x0081f7ff
[    0.000000]     1: 0x0081f800 -> 0x0081fe50
[    0.000000]     1: 0x0081fed1 -> 0x0081fed8
[    0.000000]     1: 0x0081feda -> 0x0081fedb
[    0.000000]     1: 0x0081fedd -> 0x0081fee5
[    0.000000]     1: 0x0081fee7 -> 0x0081ff51
[    0.000000]     1: 0x0081ff59 -> 0x0081ff5d

So it's a block move in that 0x81f600-->0x81f7ff region which triggers
the problem.

This patch:

Declaration of early_pfn_to_nid() is scattered over per-arch include
files, and it seems it's complicated to know when the declaration is used.
 I think it makes fix-for-memmap-init not easy.

This patch moves all declaration to include/linux/mm.h

After this,
  if !CONFIG_NODES_POPULATES_NODE_MAP && !CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
     -> Use static definition in include/linux/mm.h
  else if !CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
     -> Use generic definition in mm/page_alloc.c
  else
     -> per-arch back end function will be called.

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Tested-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Reported-by: David Miller <davem@davemlloft.net>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: <stable@kernel.org>		[2.6.25.x, 2.6.26.x, 2.6.27.x, 2.6.28.x]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-02-18 15:37:55 -08:00
..
native ia64/pv_ops: paravirtualized instruction checker. 2008-10-17 10:12:54 -07:00
sn ACPI: remove private acpica headers from driver files 2008-12-31 01:15:22 -05:00
uv
xen ia64/pv_ops/xen: define the nubmer of irqs which xen needs. 2008-10-17 10:06:59 -07:00
acpi-ext.h ACPI: remove private acpica headers from driver files 2008-12-31 01:15:22 -05:00
acpi.h
agp.h
asmmacro.h
atomic.h atomic_t: unify all arch definitions 2009-01-06 15:59:10 -08:00
auxvec.h
bitops.h
break.h ia64/xen: reserve "break" numbers used for xen hypercalls. 2008-10-17 09:52:52 -07:00
bug.h
bugs.h
byteorder.h byteorder: make swab.h include asm/swab.h like a regular header 2009-01-14 19:56:50 -08:00
cache.h
cacheflush.h [IA64] Add Variable Page Size and IA64 Support in Intel IOMMU 2008-10-17 12:14:13 -07:00
checksum.h
compat.h
cpu.h
cputime.h
current.h
cyclone.h
delay.h
device.h [IA64] Add Variable Page Size and IA64 Support in Intel IOMMU 2008-10-17 12:14:13 -07:00
div64.h
dma-mapping.h [IA64] SN specific version of dma_get_required_mask() 2009-01-15 10:42:16 -08:00
dma.h
dmi.h
elf.h [PATCH] remove unused ibcs2/PER_SVR4 in SET_PERSONALITY 2008-10-16 15:40:05 +02:00
emergency-restart.h
errno.h
esi.h
fb.h
fcntl.h
fpswa.h
fpu.h
futex.h
gcc_intrin.h
hardirq.h
hpsim.h
hugetlb.h
hw_irq.h
ia32.h
ia64regs.h
intel_intrin.h
intrinsics.h [IA64] ia64/pv_ops/pv_cpu_ops: fix _IA64_REG_IP case. 2008-11-20 13:41:20 -08:00
io.h [IA64] remove dead BIO_VMERGE_BOUNDARY definition 2008-11-04 11:31:58 -08:00
ioctl.h
ioctls.h
iommu.h x86/PCI: build failure at x86/kernel/pci-dma.c with !CONFIG_PCI 2008-10-24 11:09:43 -07:00
iosapic.h
ipcbuf.h
irq.h ia64: cpumask fix for is_affinity_mask_valid() 2009-01-04 15:39:24 +01:00
irq_regs.h
Kbuild byteorder: make swab.h include asm/swab.h like a regular header 2009-01-14 19:56:50 -08:00
kdebug.h
kexec.h kexec jump: rename KEXEC_CONTROL_CODE_SIZE to KEXEC_CONTROL_PAGE_SIZE 2008-08-15 08:35:42 -07:00
kmap_types.h
kprobes.h
kregs.h [IA64] Fix annoying IA64_TR_ALLOC_MAX message. 2008-10-17 13:47:53 -07:00
kvm.h KVM: Avoid using CONFIG_ in userspace visible headers 2009-02-15 02:47:35 +02:00
kvm_host.h KVM: change KVM to use IOMMU API 2009-01-03 14:11:07 +01:00
kvm_para.h
libata-portmap.h
linkage.h
local.h
machvec.h [IA64] SN specific version of dma_get_required_mask() 2009-01-15 10:42:16 -08:00
machvec_dig.h
machvec_dig_vtd.h [IA64] Add Variable Page Size and IA64 Support in Intel IOMMU 2008-10-17 12:14:13 -07:00
machvec_hpsim.h
machvec_hpzx1.h
machvec_hpzx1_swiotlb.h
machvec_init.h [IA64] SN specific version of dma_get_required_mask() 2009-01-15 10:42:16 -08:00
machvec_sn2.h [IA64] SN specific version of dma_get_required_mask() 2009-01-15 10:42:16 -08:00
machvec_uv.h
machvec_xen.h ia64/xen: define xen machine vector for domU. 2008-10-17 10:08:56 -07:00
mc146818rtc.h
mca.h
mca_asm.h
meminit.h [IA64] fix the difference between node_mem_map and node_start_pfn 2008-11-04 11:31:12 -08:00
mman.h
mmu.h
mmu_context.h
mmzone.h mm: clean up for early_pfn_to_nid() 2009-02-18 15:37:55 -08:00
module.h
msgbuf.h
mutex.h
nodedata.h
numa.h
page.h
pal.h
param.h
paravirt.h ia64/pv_ops: avoid name conflict of get_irq_chip(). 2008-10-17 09:50:55 -07:00
paravirt_privop.h [IA64] remove BUILD_BUG_ON from paravirt_getreg() 2008-12-09 10:01:26 -08:00
parport.h
patch.h
pci.h Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6 2008-10-23 08:07:35 -07:00
percpu.h
perfmon.h
perfmon_default_smpl.h
pgalloc.h
pgtable.h
poll.h
posix_types.h
processor.h
ptrace.h remove __ARCH_WANT_COMPAT_SYS_PTRACE 2008-11-30 11:00:15 -08:00
ptrace_offsets.h
pvclock-abi.h ia64/xen: add a necessary header file to compile include/xen/interface/xen.h 2008-10-17 09:57:28 -07:00
resource.h
rse.h
rwsem.h
sal.h [IA64] Add error_recovery_info field to SAL section header 2008-11-04 11:30:43 -08:00
scatterlist.h
sections.h [IA64] Put the space for cpu0 per-cpu area into .data section 2008-09-29 16:39:19 -07:00
segment.h
sembuf.h
serial.h
setup.h
shmbuf.h
shmparam.h
sigcontext.h
siginfo.h signals: demultiplexing SIGTRAP signal 2008-09-23 13:26:52 +02:00
signal.h
smp.h cpumask: centralize cpu_online_map and cpu_possible_map 2008-12-13 21:19:41 +10:30
socket.h
sockios.h
sparsemem.h
spinlock.h
spinlock_types.h
stat.h
statfs.h IA64: Use <asm-generic/statfs.h> 2008-09-04 09:46:13 +01:00
string.h
suspend.h
swab.h ia64: introduce asm/swab.h 2009-01-06 18:10:28 -08:00
swiotlb.h swiotlb: replace architecture-specific swiotlb.h with linux/swiotlb.h 2008-12-28 10:04:00 +01:00
sync_bitops.h ia64/xen: introduce sync bitops which is necessary for ia64/xen support. 2008-10-17 09:53:33 -07:00
syscall.h [IA64] utrace Convert compat ptrace to use compat_sys_ptrace 2008-10-06 10:45:29 -07:00
system.h
termbits.h
termios.h
thread_info.h [IA64] utrace use generic trace hook 2008-10-06 10:43:06 -07:00
timex.h ia64: move function declaration, ia64_cpu_local_tick() from .c to .h 2008-10-17 09:52:08 -07:00
tlb.h
tlbflush.h
topology.h [IA64] fix typo in cpumask_of_pcibus() 2009-01-06 16:19:22 +01:00
types.h
uaccess.h
ucontext.h
unaligned.h
uncached.h
unistd.h [CVE-2009-0029] Remove __attribute__((weak)) from sys_pipe/sys_pipe2 2009-01-14 14:15:15 +01:00
unwind.h
user.h
ustack.h
vga.h
xor.h