public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix the issue that lowmemkiller fell into a cycle that try to kill a task
@ 2014-09-23  2:57 Hui Zhu
  2014-09-23  4:17 ` Greg KH
  2014-09-24 15:34 ` Rik van Riel
  0 siblings, 2 replies; 8+ messages in thread
From: Hui Zhu @ 2014-09-23  2:57 UTC (permalink / raw)
  To: gregkh, rientjes, vinayakm.list, weijie.yang
  Cc: devel, linux-kernel, teawater, Hui Zhu

The cause of this issue is when free memroy size is low and a lot of task is
trying to shrink the memory, the task that is killed by lowmemkiller cannot get
CPU to exit itself.

Fix this issue with change the scheduling policy to SCHED_FIFO if a task's flag
is TIF_MEMDIE in lowmemkiller.

Signed-off-by: Hui Zhu <zhuhui@xiaomi.com>
---
 drivers/staging/android/lowmemorykiller.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c
index b545d3d..ca1ffac 100644
--- a/drivers/staging/android/lowmemorykiller.c
+++ b/drivers/staging/android/lowmemorykiller.c
@@ -129,6 +129,10 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc)
 
 		if (test_tsk_thread_flag(p, TIF_MEMDIE) &&
 		    time_before_eq(jiffies, lowmem_deathpending_timeout)) {
+			struct sched_param param = { .sched_priority = 1 };
+
+			if (p->policy == SCHED_NORMAL)
+				sched_setscheduler(p, SCHED_FIFO, &param);
 			task_unlock(p);
 			rcu_read_unlock();
 			return 0;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-10-14  7:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-23  2:57 [PATCH] Fix the issue that lowmemkiller fell into a cycle that try to kill a task Hui Zhu
2014-09-23  4:17 ` Greg KH
2014-09-23  4:48   ` 朱辉
2014-09-23  8:00     ` Weijie Yang
2014-09-23 14:28       ` 朱辉
2014-09-23 22:24         ` David Rientjes
2014-09-24 15:34 ` Rik van Riel
2014-10-14  6:51   ` 朱辉

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox