New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 903298 link

Starred by 1 user

Issue metadata

Status: Started
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug

Blocking:
issue 896805



Sign in to add a comment

Launch patch "mark pinned shmemfs pages as unevictable"

Project Member Reported by vovoy@chromium.org, Nov 8

Issue description

The current patch in chromium tree is a temp solution.
https://chromium.googlesource.com/chromiumos/third_party/kernel/+/ee2c6601587f537c11705998db6058aabc2240c4

Replace the temp solution with the reviewed patch:
https://cgit.freedesktop.org/drm-intel/commit/?id=64e3d12f769d60eaee6d2e53a9b7f0b3814f32ed

The mm interface exported in the reviewed patch is useful to solve similar issue on Kevin.

 
Blocking: 896805
Cc: marc...@chromium.org hoegsberg@google.com sonnyrao@chromium.org
Components: OS>Performance>Memory
Labels: OS-Chrome
Cc: -hoegsberg@google.com hoegsberg@chromium.org
This reviewed patch solved the issue https://crbug.com/800237
Are you able to investigate the issue for kevin?
Also, the msm driver may have the same problem.
I am working on a patch to mark pinned pages unevictable in drm_gem_get_pages(), the patch should fix similar issues in rockchip (Kevin) and msm drivers.
I see, that does look like it should take care of our other gem drivers. Thanks - I assume you will post updates here?
Project Member

Comment 7 by bugdroid1@chromium.org, Nov 13

Labels: merge-merged-chromeos-4.19
The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/c2d3bee4a255735d47ea48a9d967c44fe6403e63

commit c2d3bee4a255735d47ea48a9d967c44fe6403e63
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Tue Nov 13 06:45:33 2018

FROMGIT: drm/i915: Break long iterations for get/put shmemfs pages

As we may have to iterate a few thousand elements to acquire and release
the shmemfs backing storage for a GPU object, we need to break up the
long loop with cond_resched() to retain a modicum of low latency for
other processes.

Testcase: igt/benchmarks/gem_syslatency
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Kuo-Hsin Yang <vovoy@chromium.org>
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181105170640.26905-1-chris@chris-wilson.co.uk
(cherry picked from commit e6db7f4d7c5005258b862a5ed1732756fccb6bfa
 git://anongit.freedesktop.org/drm-intel drm-intel-next-queued)

BUG=chromium:903298
TEST=build kernel and boot.

Change-Id: I57f27166f333164b641e47a0f0a2089526697ab2
Signed-off-by: Kuo-Hsin Yang <vovoy@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1328422
Commit-Ready: Vovo Yang <vovoy@chromium.org>
Tested-by: Vovo Yang <vovoy@chromium.org>
Reviewed-by: Sonny Rao <sonnyrao@chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/c2d3bee4a255735d47ea48a9d967c44fe6403e63/drivers/gpu/drm/i915/i915_gem.c

Project Member

Comment 8 by bugdroid1@chromium.org, Nov 13

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/470a3b5adecdefaa34e905faf338bcd408949ea2

commit 470a3b5adecdefaa34e905faf338bcd408949ea2
Author: Kuo-Hsin Yang <vovoy@chromium.org>
Date: Tue Nov 13 06:45:35 2018

FROMGIT: 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>
(cherry picked from commit 64e3d12f769d60eaee6d2e53a9b7f0b3814f32ed
 git://anongit.freedesktop.org/drm-intel drm-intel-next-queued)

BUG=chromium:903298
TEST=check i915 gtt bounded object pages are in the unevictable list

Change-Id: Ia5322116b957907deb46a059301e3f238b19840e
Reviewed-on: https://chromium-review.googlesource.com/1328423
Commit-Ready: Vovo Yang <vovoy@chromium.org>
Tested-by: Vovo Yang <vovoy@chromium.org>
Reviewed-by: Sonny Rao <sonnyrao@chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/470a3b5adecdefaa34e905faf338bcd408949ea2/drivers/gpu/drm/i915/i915_gem.c
[modify] https://crrev.com/470a3b5adecdefaa34e905faf338bcd408949ea2/Documentation/vm/unevictable-lru.rst
[modify] https://crrev.com/470a3b5adecdefaa34e905faf338bcd408949ea2/mm/shmem.c
[modify] https://crrev.com/470a3b5adecdefaa34e905faf338bcd408949ea2/include/linux/swap.h
[modify] https://crrev.com/470a3b5adecdefaa34e905faf338bcd408949ea2/mm/vmscan.c

I will post update on crbug.com/896805
Project Member

Comment 10 by bugdroid1@chromium.org, Nov 13

Labels: merge-merged-chromeos-4.14
The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/819d3cf99db6866a231b9e8fc5e198467bb86ec4

commit 819d3cf99db6866a231b9e8fc5e198467bb86ec4
Author: Kuo-Hsin Yang <vovoy@chromium.org>
Date: Tue Nov 13 16:22:50 2018

Revert "FROMLIST: mm, drm/i915: Mark pinned shmemfs pages as unevictable"

This reverts commit ee2c6601587f537c11705998db6058aabc2240c4.

The patch to revert is a temp solution, replace it with upstream
reviewed patch [1]. The reviewed patch provides better mm interface to
mark an unevictable mapping, the mm interface is useful to solve similar
pinned pages issue on other boards, e.g. Kevin.

[1] https://patchwork.freedesktop.org/patch/msgid/20181106132324.17390-1-chris@chris-wilson.co.uk

BUG=chromium:903298
TEST=build kernel and boot

Change-Id: I2bb4a8a31d250412485b48801ac7c361010b1a5b
Signed-off-by: Kuo-Hsin Yang <vovoy@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1326861
Commit-Ready: Vovo Yang <vovoy@chromium.org>
Tested-by: Vovo Yang <vovoy@chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/819d3cf99db6866a231b9e8fc5e198467bb86ec4/drivers/gpu/drm/i915/i915_gem.c
[modify] https://crrev.com/819d3cf99db6866a231b9e8fc5e198467bb86ec4/mm/mlock.c

Project Member

Comment 11 by bugdroid1@chromium.org, Nov 13

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/a67cb8af5279ca42ef0805446627d94b7af59b88

commit a67cb8af5279ca42ef0805446627d94b7af59b88
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Tue Nov 13 16:22:51 2018

FROMGIT: drm/i915: Break long iterations for get/put shmemfs pages

As we may have to iterate a few thousand elements to acquire and release
the shmemfs backing storage for a GPU object, we need to break up the
long loop with cond_resched() to retain a modicum of low latency for
other processes.

Testcase: igt/benchmarks/gem_syslatency
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Kuo-Hsin Yang <vovoy@chromium.org>
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181105170640.26905-1-chris@chris-wilson.co.uk

(cherry picked from commit e6db7f4d7c5005258b862a5ed1732756fccb6bfa
 git://anongit.freedesktop.org/drm-intel drm-intel-next-queued)

BUG=chromium:903298
TEST=build kernel and boot.
CQ-DEPEND=CL:1326861

Change-Id: Idb153bf2540c24e1526be901d509112ad343fbd8
Signed-off-by: Kuo-Hsin Yang <vovoy@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1326862
Commit-Ready: Vovo Yang <vovoy@chromium.org>
Tested-by: Vovo Yang <vovoy@chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/a67cb8af5279ca42ef0805446627d94b7af59b88/drivers/gpu/drm/i915/i915_gem.c

Project Member

Comment 12 by bugdroid1@chromium.org, Nov 13

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/24b2ed64df30347820ee926d85ed6f2eeeb871be

commit 24b2ed64df30347820ee926d85ed6f2eeeb871be
Author: Kuo-Hsin Yang <vovoy@chromium.org>
Date: Tue Nov 13 16:22:53 2018

FROMGIT: 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>
(cherry picked from commit 64e3d12f769d60eaee6d2e53a9b7f0b3814f32ed
 git://anongit.freedesktop.org/drm-intel drm-intel-next-queued)

BUG=chromium:903298
TEST=check i915 gtt bounded object pages are in the unevictable list
CQ-DEPEND=CL:1326862

Change-Id: I7a43926f4e03d5ffdf581c6034d99d4c73cc9a64
Reviewed-on: https://chromium-review.googlesource.com/1326863
Commit-Ready: Vovo Yang <vovoy@chromium.org>
Tested-by: Vovo Yang <vovoy@chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>

[modify] https://crrev.com/24b2ed64df30347820ee926d85ed6f2eeeb871be/drivers/gpu/drm/i915/i915_gem.c
[modify] https://crrev.com/24b2ed64df30347820ee926d85ed6f2eeeb871be/Documentation/vm/unevictable-lru.txt
[modify] https://crrev.com/24b2ed64df30347820ee926d85ed6f2eeeb871be/mm/shmem.c
[modify] https://crrev.com/24b2ed64df30347820ee926d85ed6f2eeeb871be/include/linux/swap.h
[modify] https://crrev.com/24b2ed64df30347820ee926d85ed6f2eeeb871be/mm/vmscan.c

Project Member

Comment 13 by bugdroid1@chromium.org, Nov 15

Labels: merge-merged-chromeos-4.4
The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/426d744c5e66aa6abaf9e9640e1908fdcc0852f0

commit 426d744c5e66aa6abaf9e9640e1908fdcc0852f0
Author: Kuo-Hsin Yang <vovoy@chromium.org>
Date: Thu Nov 15 16:11:18 2018

Revert "FROMLIST: mm, drm/i915: Mark pinned shmemfs pages as unevictable"

This reverts commit 5b81d145d3719a2167a0bb2475aafd7730c32167.

The patch to revert is a temp solution, replace it with upstream
reviewed patch [1]. The reviewed patch provides better mm interface to
mark an unevictable mapping, the mm interface is useful to solve similar
pinned pages issue on other boards, e.g. Kevin.

[1] https://patchwork.freedesktop.org/patch/msgid/20181106132324.17390-1-chris@chris-wilson.co.uk

BUG=chromium:903298
TEST=build kernel and boot

Change-Id: I99b30a8afb67310da7c072a176f2cb1efb35e387
Signed-off-by: Kuo-Hsin Yang <vovoy@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1328428
Commit-Ready: Vovo Yang <vovoy@chromium.org>
Tested-by: Vovo Yang <vovoy@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Sonny Rao <sonnyrao@chromium.org>

[modify] https://crrev.com/426d744c5e66aa6abaf9e9640e1908fdcc0852f0/drivers/gpu/drm/i915/i915_gem.c
[modify] https://crrev.com/426d744c5e66aa6abaf9e9640e1908fdcc0852f0/mm/mlock.c

Project Member

Comment 14 by bugdroid1@chromium.org, Nov 15

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/b4d700101f98b909001ef28ddedf09cfa822aa84

commit b4d700101f98b909001ef28ddedf09cfa822aa84
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Thu Nov 15 16:11:20 2018

FROMGIT: drm/i915: Break long iterations for get/put shmemfs pages

As we may have to iterate a few thousand elements to acquire and release
the shmemfs backing storage for a GPU object, we need to break up the
long loop with cond_resched() to retain a modicum of low latency for
other processes.

Testcase: igt/benchmarks/gem_syslatency
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Kuo-Hsin Yang <vovoy@chromium.org>
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181105170640.26905-1-chris@chris-wilson.co.uk

(cherry picked from commit e6db7f4d7c5005258b862a5ed1732756fccb6bfa
 git://anongit.freedesktop.org/drm-intel drm-intel-next-queued)

BUG=chromium:903298
TEST=build kernel and boot.
CQ-DEPEND=CL:1328428

Change-Id: Ieb104be842bd533c55810e71783c60ffba634665
Signed-off-by: Kuo-Hsin Yang <vovoy@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1328429
Commit-Ready: Vovo Yang <vovoy@chromium.org>
Tested-by: Vovo Yang <vovoy@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>

[modify] https://crrev.com/b4d700101f98b909001ef28ddedf09cfa822aa84/drivers/gpu/drm/i915/i915_gem.c

Project Member

Comment 15 by bugdroid1@chromium.org, Nov 15

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/b66e69e78fa3906e703881044e870eccfbfb506e

commit b66e69e78fa3906e703881044e870eccfbfb506e
Author: Kuo-Hsin Yang <vovoy@chromium.org>
Date: Thu Nov 15 16:11:21 2018

FROMGIT: 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>
(cherry picked from commit 64e3d12f769d60eaee6d2e53a9b7f0b3814f32ed
 git://anongit.freedesktop.org/drm-intel drm-intel-next-queued)

BUG=chromium:903298
TEST=check i915 gtt bounded object pages are in the unevictable list
CQ-DEPEND=CL:1328429

Change-Id: I0eb8dac696d6f06b93b7c74f8b6547063a71cc93
Reviewed-on: https://chromium-review.googlesource.com/1328430
Commit-Ready: Vovo Yang <vovoy@chromium.org>
Tested-by: Vovo Yang <vovoy@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Sonny Rao <sonnyrao@chromium.org>

[modify] https://crrev.com/b66e69e78fa3906e703881044e870eccfbfb506e/drivers/gpu/drm/i915/i915_gem.c
[modify] https://crrev.com/b66e69e78fa3906e703881044e870eccfbfb506e/Documentation/vm/unevictable-lru.txt
[modify] https://crrev.com/b66e69e78fa3906e703881044e870eccfbfb506e/mm/shmem.c
[modify] https://crrev.com/b66e69e78fa3906e703881044e870eccfbfb506e/include/linux/swap.h
[modify] https://crrev.com/b66e69e78fa3906e703881044e870eccfbfb506e/mm/vmscan.c

Sign in to add a comment