projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
28152a2
)
drm/i915/shrinker: Wrap need_resched() inside preempt-disable
author
Chris Wilson
<
[email protected]
>
Fri, 4 Aug 2017 10:41:35 +0000
(11:41 +0100)
committer
Chris Wilson
<
[email protected]
>
Fri, 4 Aug 2017 12:11:39 +0000
(13:11 +0100)
In order for us to successfully detect the end of a timeslice,
preemption must be disabled. Otherwise, inside the loop we may be
preempted many times without our noticing, and each time our timeslice
will be reset, invalidating need_resched()
Reported-by: Joonas Lahtinen <
[email protected]
>
Reported-by: Tomi Sarvela <
[email protected]
>
Fixes: 290271de34f6 ("drm/i915: Spin for struct_mutex inside shrinker")
Signed-off-by: Chris Wilson <
[email protected]
>
Cc: Mika Kuoppala <
[email protected]
>
Cc: Joonas Lahtinen <
[email protected]
>
Cc: <
[email protected]
> # v4.13-rc1+
Link:
https://patchwork.freedesktop.org/patch/msgid/
[email protected]
Tested-by: Joonas Lahtinen <
[email protected]
>
Reviewed-by: Joonas Lahtinen <
[email protected]
>
drivers/gpu/drm/i915/i915_gem_shrinker.c
patch
|
blob
|
history
diff --git
a/drivers/gpu/drm/i915/i915_gem_shrinker.c
b/drivers/gpu/drm/i915/i915_gem_shrinker.c
index 1032f98add112a66a19fb186a2b28de773caadf8..77fb3980813143d2d9e3432c0ebb994a4bcad032 100644
(file)
--- a/
drivers/gpu/drm/i915/i915_gem_shrinker.c
+++ b/
drivers/gpu/drm/i915/i915_gem_shrinker.c
@@
-43,16
+43,21
@@
static bool shrinker_lock(struct drm_i915_private *dev_priv, bool *unlock)
return true;
case MUTEX_TRYLOCK_FAILED:
+ *unlock = false;
+ preempt_disable();
do {
cpu_relax();
if (mutex_trylock(&dev_priv->drm.struct_mutex)) {
- case MUTEX_TRYLOCK_SUCCESS:
*unlock = true;
-
return true
;
+
break
;
}
} while (!need_resched());
+ preempt_enable();
+ return *unlock;
- return false;
+ case MUTEX_TRYLOCK_SUCCESS:
+ *unlock = true;
+ return true;
}
BUG();