linux/arch/ia64
Jianguo Wu 7f1290f2f2 mm: fix-up zone present pages
I think zone->present_pages indicates pages that buddy system can management,
it should be:

	zone->present_pages = spanned pages - absent pages - bootmem pages,

but is now:
	zone->present_pages = spanned pages - absent pages - memmap pages.

spanned pages: total size, including holes.
absent pages: holes.
bootmem pages: pages used in system boot, managed by bootmem allocator.
memmap pages: pages used by page structs.

This may cause zone->present_pages less than it should be.  For example,
numa node 1 has ZONE_NORMAL and ZONE_MOVABLE, it's memmap and other
bootmem will be allocated from ZONE_MOVABLE, so ZONE_NORMAL's
present_pages should be spanned pages - absent pages, but now it also
minus memmap pages(free_area_init_core), which are actually allocated from
ZONE_MOVABLE.  When offlining all memory of a zone, this will cause
zone->present_pages less than 0, because present_pages is unsigned long
type, it is actually a very large integer, it indirectly caused
zone->watermark[WMARK_MIN] becomes a large
integer(setup_per_zone_wmarks()), than cause totalreserve_pages become a
large integer(calculate_totalreserve_pages()), and finally cause memory
allocating failure when fork process(__vm_enough_memory()).

[root@localhost ~]# dmesg
-bash: fork: Cannot allocate memory

I think the bug described in

  http://marc.info/?l=linux-mm&m=134502182714186&w=2

is also caused by wrong zone present pages.

This patch intends to fix-up zone->present_pages when memory are freed to
buddy system on x86_64 and IA64 platforms.

Signed-off-by: Jianguo Wu <wujianguo@huawei.com>
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Reported-by: Petr Tesarik <ptesarik@suse.cz>
Tested-by: Petr Tesarik <ptesarik@suse.cz>
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Minchan Kim <minchan.kim@gmail.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-10-09 16:22:54 +09:00
..
configs [IA64] defconfig: Remove CONFIG_MISC_DEVICES 2012-08-20 13:04:29 -07:00
dig Disintegrate asm/system.h for IA64 2012-03-28 18:30:02 +01:00
hp TTY: use tty_port_link_device 2012-08-13 16:50:19 -07:00
include mm: hugetlb: add arch hook for clearing page flags before entering pool 2012-10-09 16:22:24 +09:00
kernel mm: kill vma flag VM_RESERVED and mm->reserved_vm counter 2012-10-09 16:22:19 +09:00
kvm KVM: split kvm_arch_flush_shadow 2012-09-06 16:37:25 +03:00
lib Fix common misspellings 2011-03-31 11:26:23 -03:00
mm mm: fix-up zone present pages 2012-10-09 16:22:54 +09:00
oprofile Disintegrate asm/system.h for IA64 2012-03-28 18:30:02 +01:00
pci Merge branch 'pci/yinghai-misc' into next 2012-09-24 17:24:11 -06:00
scripts scripts: change scripts to use system python instead of env 2010-02-02 14:33:56 +01:00
sn ia64/PCI: Use hotplug-safe pci_get_domain_bus_and_slot() 2012-09-12 14:10:33 -06:00
uv ia64: change to new flag variables 2011-03-17 14:02:56 +01:00
xen sections: fix section conflicts in arch/ia64 2012-10-06 03:04:39 +09:00
install.sh kbuild: use INSTALLKERNEL to select customized installkernel script 2009-09-20 12:18:14 +02:00
Kconfig cputime: Generalize CONFIG_VIRT_CPU_ACCOUNTING 2012-08-17 16:31:08 +02:00
Kconfig.debug
Makefile Merge commit 'v2.6.35' into kbuild/kbuild 2010-08-04 13:59:13 +02:00
module.lds