mm, drm/i915: mark pinned shmemfs pages as unevictable
authorKuo-Hsin Yang <vovoy@chromium.org>
Tue, 6 Nov 2018 13:23:24 +0000 (13:23 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Wed, 7 Nov 2018 15:28:32 +0000 (15:28 +0000)
commit64e3d12f769d60eaee6d2e53a9b7f0b3814f32ed
tree7038d1180a6a6bd19db14e92336c602686a3e7df
parentf45a7977d1140c11f334e01a9f77177ed68e3bfa
mm, drm/i915: mark pinned shmemfs pages as unevictable

The i915 driver uses shmemfs to allocate backing storage for gem
objects. These shmemfs pages can be pinned (increased ref count) by
shmem_read_mapping_page_gfp(). When a lot of pages are pinned, vmscan
wastes a lot of time scanning these pinned pages. In some extreme case,
all pages in the inactive anon lru are pinned, and only the inactive
anon lru is scanned due to inactive_ratio, the system cannot swap and
invokes the oom-killer. Mark these pinned pages as unevictable to speed
up vmscan.

Export pagevec API check_move_unevictable_pages().

This patch was inspired by Chris Wilson's change [1].

[1]: https://patchwork.kernel.org/patch/9768741/

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Dave Hansen <dave.hansen@intel.com>
Signed-off-by: Kuo-Hsin Yang <vovoy@chromium.org>
Acked-by: Michal Hocko <mhocko@suse.com> # mm part
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Acked-by: Dave Hansen <dave.hansen@intel.com>
Acked-by: Andrew Morton <akpm@linux-foundation.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20181106132324.17390-1-chris@chris-wilson.co.uk
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Documentation/vm/unevictable-lru.rst
drivers/gpu/drm/i915/i915_gem.c
include/linux/swap.h
mm/shmem.c
mm/vmscan.c