android_kernel_samsung_a7y1.../mm
Punit Agrawal 9a2f8274ef mm, gup: ensure real head page is ref-counted when using hugepages
commit d63206ee32b6e64b0e12d46e5d6004afd9913713 upstream.

When speculatively taking references to a hugepage using
page_cache_add_speculative() in gup_huge_pmd(), it is assumed that the
page returned by pmd_page() is the head page.  Although normally true,
this assumption doesn't hold when the hugepage comprises of successive
page table entries such as when using contiguous bit on arm64 at PTE or
PMD levels.

This can be addressed by ensuring that the page passed to
page_cache_add_speculative() is the real head or by de-referencing the
head page within the function.

We take the first approach to keep the usage pattern aligned with
page_cache_get_speculative() where users already pass the appropriate
page, i.e., the de-referenced head.

Apply the same logic to fix gup_huge_[pud|pgd]() as well.

[punit.agrawal@arm.com: fix arm64 ltp failure]
  Link: http://lkml.kernel.org/r/20170619170145.25577-5-punit.agrawal@arm.com
Link: http://lkml.kernel.org/r/20170522133604.11392-3-punit.agrawal@arm.com
Signed-off-by: Punit Agrawal <punit.agrawal@arm.com>
Acked-by: Steve Capper <steve.capper@arm.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Hillf Danton <hillf.zj@alibaba-inc.com>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Ajay Kaher <akaher@vmware.com>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-07 14:05:11 +02:00
..
kasan
backing-dev.c
balloon_compaction.c
bootmem.c
cleancache.c
cma_debug.c
cma.c mm/cma.c: fail if fixed declaration can't be honored 2020-04-06 20:27:19 +02:00
cma.h
compaction.c
debug-pagealloc.c
debug.c
dmapool.c
early_ioremap.c
fadvise.c
failslab.c
filemap.c mm/filemap.c: don't initiate writeback if mapping has no dirty pages 2020-04-07 11:58:51 +02:00
frame_vector.c
frontswap.c
gup.c mm, gup: ensure real head page is ref-counted when using hugepages 2020-04-07 14:05:11 +02:00
highmem.c
hpa.c
huge_memory.c
hugetlb_cgroup.c mm: hugetlb: switch to css_tryget() in hugetlb_cgroup_charge_cgroup() 2020-04-07 12:26:33 +02:00
hugetlb.c
hwpoison-inject.c
init-mm.c
internal.h mm: add 'try_get_page()' helper function 2020-04-07 14:05:08 +02:00
interval_tree.c
io_record.c
Kconfig
Kconfig.debug
kmemcheck.c
kmemleak-test.c
kmemleak.c
ksm.c mm/ksm.c: don't WARN if page is still mapped in remove_stable_node() 2020-04-07 12:33:44 +02:00
list_lru.c
maccess.c
madvise.c
Makefile
memblock.c
memcontrol.c mm: memcg: switch to css_tryget() in get_mem_cgroup_from_mm() 2020-04-07 12:26:31 +02:00
memory_hotplug.c
memory-failure.c
memory.c
mempolicy.c mm/mempolicy.c: fix out of bounds write in mpol_parse_str() 2020-04-07 13:48:18 +02:00
mempool.c
memtest.c
migrate.c
mincore.c
mlock.c
mm_init.c
mmap.c
mmu_context.c
mmu_notifier.c mm/mmu_notifier: use hlist_add_head_rcu() 2020-04-06 20:16:25 +02:00
mmzone.c
mprotect.c
mremap.c
msync.c
nobootmem.c
nommu.c
oom_kill.c
page_alloc.c mm/page_alloc.c: calculate 'available' memory in a separate function 2020-04-07 13:36:28 +02:00
page_counter.c
page_ext.c
page_idle.c
page_io.c
page_isolation.c
page_owner.c
page-writeback.c mm/page-writeback.c: avoid potential division by zero in wb_min_max_ratio() 2020-04-07 13:37:49 +02:00
pagewalk.c
percpu-km.c
percpu-vm.c
percpu.c
pgtable-generic.c
process_vm_access.c
quicklist.c
readahead.c
rmap.c
shmem.c mm/shmem.c: cast the type of unmap_start to u64 2020-04-07 13:08:06 +02:00
showmem_extra.c
slab_common.c
slab.c
slab.h
slob.c
slub.c mm/slub: fix a deadlock in show_slab_objects() 2020-04-07 09:26:52 +02:00
sparse-vmemmap.c
sparse.c
swap_cgroup.c
swap_state.c
swap.c
swapfile.c
truncate.c
usercopy.c
userfaultfd.c
util.c
vmacache.c
vmalloc.c mm/vmalloc: Sync unmappings in __purge_vmap_area_lazy() 2020-04-06 20:38:23 +02:00
vmpressure.c
vmscan.c
vmstat.c mm, vmstat: hide /proc/pagetypeinfo from normal users 2020-04-07 11:48:32 +02:00
workingset.c
zbud.c
zpool.c
zsmalloc.c
zswap.c