diff mbox series

[SRU,F] UBUNTU: SAUCE: drm/i915: prevent direct writeback from the shrinker

Message ID 20200420141901.GA401476@xps-13
State New
Headers show
Series [SRU,F] UBUNTU: SAUCE: drm/i915: prevent direct writeback from the shrinker | expand

Commit Message

Andrea Righi April 20, 2020, 2:19 p.m. UTC
BugLink: https://bugs.launchpad.net/bugs/1861359

The i915 shrinker can make the system unresponsive and kill interactive
performance by swapping out dirty objects to reclaim more memory.

Avoid the lags by preventing to swap out dirty objects from any task
(except kswapd).

This is not required in 5.5+, because it is properly fixed by commit
2850748ef876 ("drm/i915: Pull i915_vma_pin under the vm->mutex")

However, backporting this commit to 5.4 is not trivial and the
regression potential is high. A simple change like this can be a
reasonable compromise to prevent the problem and avoid the risk of
introducing other bugs.

Fixes: 2d6692e642e7 ("drm/i915: Start writeback from the shrinker")
Signed-off-by: Sultan Alsawaf <sultan.alsawaf@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_shrinker.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Seth Forshee April 20, 2020, 2:32 p.m. UTC | #1
On Mon, Apr 20, 2020 at 04:19:01PM +0200, Andrea Righi wrote:
> BugLink: https://bugs.launchpad.net/bugs/1861359
> 
> The i915 shrinker can make the system unresponsive and kill interactive
> performance by swapping out dirty objects to reclaim more memory.
> 
> Avoid the lags by preventing to swap out dirty objects from any task
> (except kswapd).
> 
> This is not required in 5.5+, because it is properly fixed by commit
> 2850748ef876 ("drm/i915: Pull i915_vma_pin under the vm->mutex")
> 
> However, backporting this commit to 5.4 is not trivial and the
> regression potential is high. A simple change like this can be a
> reasonable compromise to prevent the problem and avoid the risk of
> introducing other bugs.
> 
> Fixes: 2d6692e642e7 ("drm/i915: Start writeback from the shrinker")
> Signed-off-by: Sultan Alsawaf <sultan.alsawaf@canonical.com>
> Signed-off-by: Andrea Righi <andrea.righi@canonical.com>

Acked-by: Seth Forshee <seth.forshee@canonical.com>
Kamal Mostafa April 20, 2020, 2:43 p.m. UTC | #2
Acked-by: Kamal Mostafa <kamal@canonical.com>

 -Kamal

On Mon, Apr 20, 2020 at 04:19:01PM +0200, Andrea Righi wrote:
> BugLink: https://bugs.launchpad.net/bugs/1861359
> 
> The i915 shrinker can make the system unresponsive and kill interactive
> performance by swapping out dirty objects to reclaim more memory.
> 
> Avoid the lags by preventing to swap out dirty objects from any task
> (except kswapd).
> 
> This is not required in 5.5+, because it is properly fixed by commit
> 2850748ef876 ("drm/i915: Pull i915_vma_pin under the vm->mutex")
> 
> However, backporting this commit to 5.4 is not trivial and the
> regression potential is high. A simple change like this can be a
> reasonable compromise to prevent the problem and avoid the risk of
> introducing other bugs.
> 
> Fixes: 2d6692e642e7 ("drm/i915: Start writeback from the shrinker")
> Signed-off-by: Sultan Alsawaf <sultan.alsawaf@canonical.com>
> Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
> ---
>  drivers/gpu/drm/i915/gem/i915_gem_shrinker.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_shrinker.c b/drivers/gpu/drm/i915/gem/i915_gem_shrinker.c
> index edd21d14e64f..793bd586b80b 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_shrinker.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_shrinker.c
> @@ -357,8 +357,7 @@ i915_gem_shrinker_scan(struct shrinker *shrinker, struct shrink_control *sc)
>  				sc->nr_to_scan,
>  				&sc->nr_scanned,
>  				I915_SHRINK_BOUND |
> -				I915_SHRINK_UNBOUND |
> -				I915_SHRINK_WRITEBACK);
> +				I915_SHRINK_UNBOUND);
>  	if (sc->nr_scanned < sc->nr_to_scan && current_is_kswapd()) {
>  		intel_wakeref_t wakeref;
>  
> -- 
> 2.25.1
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
Andrea Righi April 21, 2020, 6:45 a.m. UTC | #3
On Mon, Apr 20, 2020 at 04:19:03PM +0200, Andrea Righi wrote:
> BugLink: https://bugs.launchpad.net/bugs/1861359
> 
> The i915 shrinker can make the system unresponsive and kill interactive
> performance by swapping out dirty objects to reclaim more memory.
> 
> Avoid the lags by preventing to swap out dirty objects from any task
> (except kswapd).
> 
> This is not required in 5.5+, because it is properly fixed by commit
> 2850748ef876 ("drm/i915: Pull i915_vma_pin under the vm->mutex")
> 
> However, backporting this commit to 5.4 is not trivial and the
> regression potential is high. A simple change like this can be a
> reasonable compromise to prevent the problem and avoid the risk of
> introducing other bugs.
> 
> Fixes: 2d6692e642e7 ("drm/i915: Start writeback from the shrinker")
> Signed-off-by: Sultan Alsawaf <sultan.alsawaf@canonical.com>
> Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
> ---
>  drivers/gpu/drm/i915/gem/i915_gem_shrinker.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_shrinker.c b/drivers/gpu/drm/i915/gem/i915_gem_shrinker.c
> index edd21d14e64f..793bd586b80b 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_shrinker.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_shrinker.c
> @@ -357,8 +357,7 @@ i915_gem_shrinker_scan(struct shrinker *shrinker, struct shrink_control *sc)
>  				sc->nr_to_scan,
>  				&sc->nr_scanned,
>  				I915_SHRINK_BOUND |
> -				I915_SHRINK_UNBOUND |
> -				I915_SHRINK_WRITEBACK);
> +				I915_SHRINK_UNBOUND);
>  	if (sc->nr_scanned < sc->nr_to_scan && current_is_kswapd()) {
>  		intel_wakeref_t wakeref;
>  
> -- 
> 2.25.1
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_shrinker.c b/drivers/gpu/drm/i915/gem/i915_gem_shrinker.c
index edd21d14e64f..793bd586b80b 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_shrinker.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_shrinker.c
@@ -357,8 +357,7 @@  i915_gem_shrinker_scan(struct shrinker *shrinker, struct shrink_control *sc)
 				sc->nr_to_scan,
 				&sc->nr_scanned,
 				I915_SHRINK_BOUND |
-				I915_SHRINK_UNBOUND |
-				I915_SHRINK_WRITEBACK);
+				I915_SHRINK_UNBOUND);
 	if (sc->nr_scanned < sc->nr_to_scan && current_is_kswapd()) {
 		intel_wakeref_t wakeref;