* [PATCH V3] staging: android: lowmemorykiller: imporve lmk to avoid deadlock issue
@ 2015-08-03 8:26 Wang, Biao
2015-08-05 18:50 ` gregkh
0 siblings, 1 reply; 2+ messages in thread
From: Wang, Biao @ 2015-08-03 8:26 UTC (permalink / raw)
To: gregkh@linuxfoundation.org, arve@android.com,
riandrews@android.com
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
Zhang, Di, Li, Fei, dan.carpenter@oracle.com, joe@perches.com
Consider the following case:
Task A trigger lmk with a lock held, while task B try to get this lock, but unfortunately B is the very culprit task lmk select to kill. Then B will never be killed, and A will forever select B to kill.
Such dead lock will trigger softlock up issue.
This patch try to pick the next task to break this loop.
Signed-off-by: Wang Biao <biao.wang@intel.com>
Reviewed-by: Zhang Di <di.zhang@intel.com>
---
drivers/staging/android/lowmemorykiller.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c
index feafa17..23d9832 100644
--- a/drivers/staging/android/lowmemorykiller.c
+++ b/drivers/staging/android/lowmemorykiller.c
@@ -127,9 +127,10 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc)
if (!p)
continue;
- if (test_tsk_thread_flag(p, TIF_MEMDIE) &&
- time_before_eq(jiffies, lowmem_deathpending_timeout)) {
+ if (test_tsk_thread_flag(p, TIF_MEMDIE)) {
task_unlock(p);
+ if (time_after(jiffies, lowmem_deathpending_timeout))
+ continue;
rcu_read_unlock();
return 0;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH V3] staging: android: lowmemorykiller: imporve lmk to avoid deadlock issue
2015-08-03 8:26 [PATCH V3] staging: android: lowmemorykiller: imporve lmk to avoid deadlock issue Wang, Biao
@ 2015-08-05 18:50 ` gregkh
0 siblings, 0 replies; 2+ messages in thread
From: gregkh @ 2015-08-05 18:50 UTC (permalink / raw)
To: Wang, Biao
Cc: arve@android.com, riandrews@android.com,
devel@driverdev.osuosl.org, Zhang, Di, Li, Fei,
linux-kernel@vger.kernel.org, joe@perches.com,
dan.carpenter@oracle.com
On Mon, Aug 03, 2015 at 08:26:40AM +0000, Wang, Biao wrote:
> Consider the following case:
> Task A trigger lmk with a lock held, while task B try to get this lock, but unfortunately B is the very culprit task lmk select to kill. Then B will never be killed, and A will forever select B to kill.
> Such dead lock will trigger softlock up issue.
>
> This patch try to pick the next task to break this loop.
>
> Signed-off-by: Wang Biao <biao.wang@intel.com>
> Reviewed-by: Zhang Di <di.zhang@intel.com>
> ---
> drivers/staging/android/lowmemorykiller.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
Please address Dave's review comments, I'll not take this as-is, sorry.
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-08-05 18:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-03 8:26 [PATCH V3] staging: android: lowmemorykiller: imporve lmk to avoid deadlock issue Wang, Biao
2015-08-05 18:50 ` gregkh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox