]> git.karo-electronics.de Git - karo-tx-linux.git/commit
drm/ttm: Use mutex_trylock() to avoid deadlock inside shrinker functions.
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Sun, 3 Aug 2014 11:01:10 +0000 (20:01 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 5 Oct 2014 21:52:09 +0000 (14:52 -0700)
commitf8829dd6eb1c5a763545fece8f27e972b9c83a0b
tree5ab1b8f6c49d3b0c01bfae1f3743d67c1e8ec332
parent5469f7749e0abc6c39f8727176577a28d6551f58
drm/ttm: Use mutex_trylock() to avoid deadlock inside shrinker functions.

commit 22e71691fd54c637800d10816bbeba9cf132d218 upstream.

I can observe that RHEL7 environment stalls with 100% CPU usage when a
certain type of memory pressure is given. While the shrinker functions
are called by shrink_slab() before the OOM killer is triggered, the stall
lasts for many minutes.

One of reasons of this stall is that
ttm_dma_pool_shrink_count()/ttm_dma_pool_shrink_scan() are called and
are blocked at mutex_lock(&_manager->lock). GFP_KERNEL allocation with
_manager->lock held causes someone (including kswapd) to deadlock when
these functions are called due to memory pressure. This patch changes
"mutex_lock();" to "if (!mutex_trylock()) return ...;" in order to
avoid deadlock.

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/ttm/ttm_page_alloc_dma.c