linux_dsm_epyc7002/arch
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
..
alpha mm: kill vma flag VM_RESERVED and mm->reserved_vm counter 2012-10-09 16:22:19 +09:00
arm readahead: fault retry breaks mmap file read random detection 2012-10-09 16:22:47 +09:00
arm64 Kconfig: clean up the "#if defined(arch)" list for exception-trace sysctl entry 2012-10-09 16:22:14 +09:00
avr32 readahead: fault retry breaks mmap file read random detection 2012-10-09 16:22:47 +09:00
blackfin Kconfig: clean up the long arch list for the UID16 config option 2012-10-09 16:22:13 +09:00
c6x Merge branch 'uapi-prep' of git://git.infradead.org/users/dhowells/linux-headers 2012-10-07 07:55:10 +09:00
cris readahead: fault retry breaks mmap file read random detection 2012-10-09 16:22:47 +09:00
frv Kconfig: clean up the long arch list for the DEBUG_BUGVERBOSE config option 2012-10-09 16:22:14 +09:00
h8300 Kconfig: clean up the long arch list for the UID16 config option 2012-10-09 16:22:13 +09:00
hexagon readahead: fault retry breaks mmap file read random detection 2012-10-09 16:22:47 +09:00
ia64 mm: fix-up zone present pages 2012-10-09 16:22:54 +09:00
m32r Kconfig: clean up the long arch list for the DEBUG_BUGVERBOSE config option 2012-10-09 16:22:14 +09:00
m68k readahead: fault retry breaks mmap file read random detection 2012-10-09 16:22:47 +09:00
microblaze readahead: fault retry breaks mmap file read random detection 2012-10-09 16:22:47 +09:00
mips readahead: fault retry breaks mmap file read random detection 2012-10-09 16:22:47 +09:00
mn10300 cross-arch: don't corrupt personality flags upon exec() 2012-10-06 03:04:47 +09:00
openrisc readahead: fault retry breaks mmap file read random detection 2012-10-09 16:22:47 +09:00
parisc mm: replace vma prio_tree with an interval tree 2012-10-09 16:22:39 +09:00
powerpc readahead: fault retry breaks mmap file read random detection 2012-10-09 16:22:47 +09:00
s390 readahead: fault retry breaks mmap file read random detection 2012-10-09 16:22:47 +09:00
score Merge branch 'uapi-prep' of git://git.infradead.org/users/dhowells/linux-headers 2012-10-07 07:55:10 +09:00
sh readahead: fault retry breaks mmap file read random detection 2012-10-09 16:22:47 +09:00
sparc readahead: fault retry breaks mmap file read random detection 2012-10-09 16:22:47 +09:00
tile readahead: fault retry breaks mmap file read random detection 2012-10-09 16:22:47 +09:00
um readahead: fault retry breaks mmap file read random detection 2012-10-09 16:22:47 +09:00
unicore32 mm: kill vma flag VM_RESERVED and mm->reserved_vm counter 2012-10-09 16:22:19 +09:00
x86 readahead: fault retry breaks mmap file read random detection 2012-10-09 16:22:47 +09:00
xtensa readahead: fault retry breaks mmap file read random detection 2012-10-09 16:22:47 +09:00
.gitignore
Kconfig thp, x86: introduce HAVE_ARCH_TRANSPARENT_HUGEPAGE 2012-10-09 16:22:29 +09:00