android_kernel_google_msm/mm
Wanpeng Li bea7cce431 mm/hugetlb: fix total hugetlbfs pages count when using memory overcommit accouting
commit d00285884c upstream.

hugetlb_total_pages is used for overcommit calculations but the current
implementation considers only the default hugetlb page size (which is
either the first defined hugepage size or the one specified by
default_hugepagesz kernel boot parameter).

If the system is configured for more than one hugepage size, which is
possible since commit a137e1cc6d ("hugetlbfs: per mount huge page
sizes") then the overcommit estimation done by __vm_enough_memory()
(resp.  shown by meminfo_proc_show) is not precise - there is an
impression of more available/allowed memory.  This can lead to an
unexpected ENOMEM/EFAULT resp.  SIGSEGV when memory is accounted.

Testcase:
  boot: hugepagesz=1G hugepages=1
  the default overcommit ratio is 50
  before patch:

    egrep 'CommitLimit' /proc/meminfo
    CommitLimit:     55434168 kB

  after patch:

    egrep 'CommitLimit' /proc/meminfo
    CommitLimit:     54909880 kB

[akpm@linux-foundation.org: coding-style tweak]
Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
Acked-by: Michal Hocko <mhocko@suse.cz>
Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Cc: Hillf Danton <dhillf@gmail.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-28 12:12:12 -07:00
..
backing-dev.c
bootmem.c mm: sparse: fix usemap allocation above node descriptor section 2012-10-02 10:30:36 -07:00
bounce.c
cleancache.c
compaction.c mm: compaction: fix echo 1 > compact_memory return error issue 2013-01-17 08:50:43 -08:00
debug-pagealloc.c
dmapool.c mm: dmapool: use provided gfp flags for all dma_alloc_coherent() calls 2012-12-17 10:37:44 -08:00
fadvise.c mm/fadvise.c: drain all pagevecs if POSIX_FADV_DONTNEED fails to discard all pages 2013-02-28 06:59:01 -08:00
failslab.c
filemap.c
filemap_xip.c
fremap.c
highmem.c
huge_memory.c thp, memcg: split hugepage for memcg oom on cow 2013-01-17 08:50:53 -08:00
hugetlb.c mm/hugetlb: fix total hugetlbfs pages count when using memory overcommit accouting 2013-03-28 12:12:12 -07:00
hwpoison-inject.c
init-mm.c
internal.h
Kconfig
Kconfig.debug
kmemcheck.c
kmemleak-test.c
kmemleak.c
ksm.c
maccess.c
madvise.c mm: Hold a file reference in madvise_remove 2012-07-16 09:04:43 -07:00
Makefile
memblock.c x86, mm: Trim memory in memblock to be page aligned 2012-10-31 10:02:56 -07:00
memcontrol.c memcg: oom: fix totalpages calculation for memory.swappiness==0 2012-11-26 11:37:45 -08:00
memory-failure.c mm: soft offline: split thp at the beginning of soft_offline_page() 2012-12-10 10:59:39 -08:00
memory.c thp, memcg: split hugepage for memcg oom on cow 2013-01-17 08:50:53 -08:00
memory_hotplug.c memory hotplug: fix section info double registration bug 2012-10-02 10:30:06 -07:00
mempolicy.c tmpfs mempolicy: fix /proc/mounts corrupting memory 2013-01-11 09:06:49 -08:00
mempool.c
migrate.c
mincore.c
mlock.c
mm_init.c
mmap.c
mmu_context.c
mmu_notifier.c mmu_notifier_unregister NULL Pointer deref and multiple ->release() callouts 2013-02-28 06:59:00 -08:00
mmzone.c
mprotect.c
mremap.c
msync.c
nobootmem.c memblock: free allocated memblock_reserved_regions later 2012-07-16 09:04:45 -07:00
nommu.c
oom_kill.c
page-writeback.c mm: fix calculation of dirtyable memory 2013-01-11 09:06:48 -08:00
page_alloc.c mm: fix pageblock bitmap allocation 2013-02-28 06:58:58 -08:00
page_cgroup.c
page_io.c
page_isolation.c
pagewalk.c
percpu-km.c
percpu-vm.c
percpu.c
pgtable-generic.c
prio_tree.c
process_vm_access.c Fix: compat_rw_copy_check_uvector() misuse in aio, readv, writev, and security keys 2013-03-14 11:29:51 -07:00
quicklist.c
readahead.c
rmap.c mm: fix XFS oops due to dirty pages without buffers on s390 2012-10-31 10:02:56 -07:00
shmem.c tmpfs: fix use-after-free of mempolicy object 2013-02-28 06:59:01 -08:00
slab.c slab: fix the DEADLOCK issue on l3 alien lock 2012-10-13 05:38:37 +09:00
slob.c
slub.c
sparse-vmemmap.c
sparse.c mm/vmemmap: fix wrong use of virt_to_page 2012-12-10 10:59:39 -08:00
swap.c
swap_state.c
swapfile.c
thrash.c
truncate.c mm: fix invalidate_complete_page2() lock ordering 2012-10-13 05:38:51 +09:00
util.c
vmalloc.c
vmscan.c mm: bugfix: set current->reclaim_state to NULL while returning from kswapd() 2012-11-26 11:37:19 -08:00
vmstat.c