drm/ttm: Use mutex_trylock() to avoid deadlock inside shrinker functions.
drm/ttm: Use mutex_trylock() to avoid deadlock inside shrinker functions.

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 <3d00b54ad717112934d0b63b7ac2975b44022a61@I-love.SAKURA.ne.jp>
Cc: stable <4fbacc2fa0ffdbb11bf1ad6925b886ebd08dd15f@kernel.org> [3.3+]
Signed-off-by: Dave Airlie <f2295d84e358395675bc8031be58672073ae065e@redhat.com>

KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs