android_kernel_oneplus_msm8998/mm
Vinayak Menon 30781083ea mm: zbud: prevent softirq during zbud alloc, free and reclaim
The following deadlock is observed.

Core 2 waiting on mapping->tree_lock which is taken by core 6

do_raw_spin_lock
raw_spin_lock_irq
atomic_cmpxchg
page_freeze_refs
__remove_mapping
shrink_page_list
shrink_inactive_list
shrink_list
shrink_lruvec
shrink_zone
shrink_zones
do_try_to_free_pages
try_to_free_pages(?, ?, ?, ?)
__perform_reclaim
__alloc_pages_direct_reclaim
__alloc_pages_slowpath
__alloc_pages_nodemask
alloc_kmem_pages_node
alloc_thread_info_node
dup_task_struct
copy_process.part.56
do_fork
sys_clone
el0_svc_naked

Core 6 after taking mapping->tree_lock is waiting on zbud pool lock
which is held by core 5

zbud_alloc
zcache_store_page
__cleancache_put_page
cleancache_put_page
__delete_from_page_cache
spin_unlock_irq
__remove_mapping
shrink_page_list
shrink_inactive_list
shrink_list
shrink_lruvec
shrink_zone
bitmap_zero
__nodes_clear
kswapd_shrink_zone.constprop.58
balance_pgdat
kswapd_try_to_sleep
kswapd
kthread
ret_from_fork

Core 5 after taking zbud pool lock from zbud_free received an IRQ, and
after IRQ exit, softirqs were scheduled and end_page_writeback tried to
lock on mapping->tree_lock which is already held by Core 6. Deadlock.

do_raw_spin_lock
raw_spin_lock_irqsave
test_clear_page_writeba
end_page_writeback
ext4_finish_bio
ext4_end_bio
bio_endio
blk_update_request
end_clone_bio
bio_endio
blk_update_request
blk_update_bidi_request
blk_end_bidi_request
blk_end_request
mmc_blk_cmdq_complete_r
mmc_cmdq_softirq_done
blk_done_softirq
static_key_count
static_key_false
trace_softirq_exit
__do_softirq()
tick_irq_exit
irq_exit()
set_irq_regs
__handle_domain_irq
gic_handle_irq
el1_irq
exception
__list_del_entry
list_del
zbud_free
zcache_load_page
__cleancache_get_page(?

So protect zbud_alloc/free/reclaim with spink_lock_bh

CRs-Fixed: 986783
Change-Id: Ib0605b38e7371c29316ed81e43549a0b9503d531
Signed-off-by: Vinayak Menon <vinmenon@codeaurora.org>
2016-03-25 16:03:17 -07:00
..
kasan UBSAN: run-time undefined behavior sanity checker 2016-03-22 11:09:57 -07:00
backing-dev.c mm, vmstat: fix wrong WQ sleep when memory reclaim doesn't make any progress 2016-02-17 12:31:06 -08:00
balloon_compaction.c mm: page migration trylock newpage at same level as oldpage 2015-11-05 19:34:48 -08:00
bootmem.c mm: Remove __init annotations from free_bootmem_late 2016-03-22 11:03:23 -07:00
cleancache.c
cma.c drivers: dma-contiguous: remove cma regions from kmemleak scan 2016-03-23 21:20:39 -07:00
cma.h
cma_debug.c
compaction.c mm: compaction: fix the page state calculation in too_many_isolated 2016-03-22 11:03:54 -07:00
debug-pagealloc.c mm: Mark free pages as read only 2016-03-22 11:03:20 -07:00
debug.c mm: make compound_head() robust 2015-11-06 17:50:42 -08:00
dmapool.c mm, page_alloc: distinguish between being unable to sleep, unwilling to sleep and avoiding waking kswapd 2015-11-06 17:50:42 -08:00
early_ioremap.c mm/early_ioremap: use offset_in_page macro 2015-11-05 19:34:48 -08:00
fadvise.c
failslab.c mm, page_alloc: rename __GFP_WAIT to __GFP_RECLAIM 2015-11-06 17:50:42 -08:00
filemap.c mm, fs: introduce mapping_gfp_constraint() 2015-11-06 17:50:42 -08:00
frame_vector.c mm: fix docbook comment for get_vaddr_frames() 2015-11-05 19:34:48 -08:00
frontswap.c
gup.c mm: introduce VM_LOCKONFAULT 2015-11-05 19:34:48 -08:00
highmem.c
huge_memory.c mm: loosen MADV_NOHUGEPAGE to enable Qemu postcopy on s390 2015-11-20 16:17:32 -08:00
hugetlb.c mm/hugetlb.c: fix resv map memory leak for placeholder entries 2015-12-12 10:15:34 -08:00
hugetlb_cgroup.c mm: make compound_head() robust 2015-11-06 17:50:42 -08:00
hwpoison-inject.c hwpoison: use page_cgroup_ino for filtering by memcg 2015-09-10 13:29:01 -07:00
init-mm.c
internal.h mm: use 'unsigned int' for page order 2015-11-06 17:50:42 -08:00
interval_tree.c
Kconfig mm: zcache: add core files 2016-03-23 21:15:13 -07:00
Kconfig.debug defconfig: 8994: enable CONFIG_DEBUG_SLUB_PANIC_ON 2016-03-22 11:03:31 -07:00
kmemcheck.c
kmemleak-test.c
kmemleak.c kmemleak : Make kmemleak_stack_scan optional using config 2016-03-22 11:03:47 -07:00
ksm.c KSM: Start KSM by default 2016-03-22 11:03:30 -07:00
list_lru.c memcg: simplify and inline __mem_cgroup_from_kmem 2015-11-05 19:34:48 -08:00
maccess.c mm/maccess.c: actually return -EFAULT from strncpy_from_unsafe 2015-11-05 19:34:48 -08:00
madvise.c mm: add a field to store names for private anonymous memory 2016-02-16 13:54:13 -08:00
Makefile mm: swap: swap ratio support 2016-03-23 21:19:04 -07:00
memblock.c mm/memblock: fix a race between search and remove 2016-03-23 21:19:51 -07:00
memcontrol.c memcg: only free spare array when readers are done 2016-02-25 12:01:22 -08:00
memory-failure.c mm: soft-offline: check return value in second __get_any_page() call 2016-02-25 12:01:21 -08:00
memory.c mm: memory: reduce fault_around_bytes 2016-03-23 21:16:02 -07:00
memory_hotplug.c mm/memory_hotplug.c: check for missing sections in test_pages_in_a_zone() 2015-12-29 17:45:49 -08:00
mempolicy.c mm: add a field to store names for private anonymous memory 2016-02-16 13:54:13 -08:00
mempool.c mm, page_alloc: distinguish between being unable to sleep, unwilling to sleep and avoiding waking kswapd 2015-11-06 17:50:42 -08:00
memtest.c
migrate.c mm: cma: add trace events for CMA alloc perf testing 2016-03-23 21:14:00 -07:00
mincore.c mm/mincore: use offset_in_page macro 2015-11-05 19:34:48 -08:00
mlock.c Merge remote-tracking branch 'lsk-44/linux-linaro-lsk-v4.4' into 44rc2 2016-03-23 20:51:00 -07:00
mm_init.c
mmap.c Merge remote-tracking branch 'lsk-44/linux-linaro-lsk-v4.4' into 44rc2 2016-03-23 20:51:00 -07:00
mmu_context.c
mmu_notifier.c mmu-notifier: add clear_young callback 2015-09-10 13:29:01 -07:00
mmzone.c
mprotect.c mm: add a field to store names for private anonymous memory 2016-02-16 13:54:13 -08:00
mremap.c mm/mremap: use offset_in_page macro 2015-11-05 19:34:48 -08:00
msync.c mm/msync: use offset_in_page macro 2015-11-05 19:34:48 -08:00
nobootmem.c mm: Remove __init annotations from free_bootmem_late 2016-03-22 11:03:23 -07:00
nommu.c mm/nommu.c: drop unlikely inside BUG_ON() 2015-11-05 19:34:48 -08:00
oom_kill.c mm, oom: make dump_tasks public 2016-03-22 11:03:30 -07:00
page-writeback.c mm: page-writeback: fix page state calculation in throttle_vm_writeout 2016-03-22 11:03:54 -07:00
page_alloc.c mm: switch KASan hook calling order in page alloc/free path 2016-03-22 11:03:46 -07:00
page_counter.c mm: page_counter: let page_counter_try_charge() return bool 2015-11-05 19:34:48 -08:00
page_ext.c mm: introduce idle page tracking 2015-09-10 13:29:01 -07:00
page_idle.c mm: introduce idle page tracking 2015-09-10 13:29:01 -07:00
page_io.c
page_isolation.c mm, page_isolation: make set/unset_migratetype_isolate() file-local 2015-09-08 15:35:28 -07:00
page_owner.c
pagewalk.c
percpu-km.c
percpu-vm.c
percpu.c mm/percpu: use offset_in_page macro 2015-11-05 19:34:48 -08:00
pgtable-generic.c mm,thp: khugepaged: call pte flush at the time of collapse 2016-02-25 12:01:23 -08:00
process_vm_access.c ptrace: use fsuid, fsgid, effective creds for fs access checks 2016-02-25 12:01:16 -08:00
quicklist.c
readahead.c mm: change initial readahead window size calculation 2016-03-22 11:03:39 -07:00
rmap.c mm: page migration use migration entry for swapcache too 2015-11-05 19:34:48 -08:00
shmem.c ashmem: Add shmem_set_file to mm/shmem.c 2016-01-11 09:48:49 +05:30
showmem.c mm: showmem: make the notifiers atomic 2016-03-22 11:03:55 -07:00
slab.c slab/slub: adjust kmem_cache_alloc_bulk API 2015-11-22 11:58:44 -08:00
slab.h slab/slub: adjust kmem_cache_alloc_bulk API 2015-11-22 11:58:44 -08:00
slab_common.c slab/slub: adjust kmem_cache_alloc_bulk API 2015-11-22 11:58:44 -08:00
slob.c slab/slub: adjust kmem_cache_alloc_bulk API 2015-11-22 11:58:44 -08:00
slub.c mm: slub: call kasan_alloc_pages before freeing pages in slub 2016-03-22 11:10:45 -07:00
sparse-vmemmap.c
sparse.c
swap.c mm: make compound_head() robust 2015-11-06 17:50:42 -08:00
swap_cgroup.c
swap_ratio.c mm: swap: swap ratio support 2016-03-23 21:19:04 -07:00
swap_state.c mm: swap: fix swapcache usage for fast swap devices 2016-03-23 21:13:01 -07:00
swapfile.c mm: swap: swap ratio support 2016-03-23 21:19:04 -07:00
truncate.c mm + fs: extends support for cache dropping 2016-03-23 21:24:12 -07:00
userfaultfd.c
util.c mm/util: use offset_in_page macro 2015-11-05 19:34:48 -08:00
vmacache.c mm/vmacache: inline vmacache_valid_mm() 2015-11-05 19:34:48 -08:00
vmalloc.c mm: Update is_vmalloc_addr to account for vmalloc savings 2016-03-22 11:03:59 -07:00
vmpressure.c mm: vmpressure: account allocstalls only on higher pressures 2016-03-22 11:03:53 -07:00
vmscan.c mm: swap: don't delay swap free for fast swap devices 2016-03-22 11:03:52 -07:00
vmstat.c vmstat: Remove BUG_ON from vmstat_update 2016-03-23 21:22:15 -07:00
workingset.c
zbud.c mm: zbud: prevent softirq during zbud alloc, free and reclaim 2016-03-25 16:03:17 -07:00
zcache.c mm: zcache: fix locking sequence 2016-03-25 16:03:08 -07:00
zpool.c mm: zsmalloc: constify struct zs_pool name 2015-11-06 17:50:42 -08:00
zsmalloc.c zsmalloc: fix migrate_zspage-zs_free race condition 2016-02-17 12:31:06 -08:00
zswap.c mm/zswap: change incorrect strncmp use to strcmp 2015-12-18 14:25:40 -08:00