Skip to content

Commit 341aea2

Browse files
kosakitorvalds
authored andcommitted
oom-kill: remove boost_dying_task_prio()
This is an almost-revert of commit 93b43fa ("oom: give the dying task a higher priority"). That commit dramatically improved oom killer logic when a fork-bomb occurs. But I've found that it has nasty corner case. Now cpu cgroup has strange default RT runtime. It's 0! That said, if a process under cpu cgroup promote RT scheduling class, the process never run at all. If an admin inserts a !RT process into a cpu cgroup by setting rtruntime=0, usually it runs perfectly because a !RT task isn't affected by the rtruntime knob. But if it promotes an RT task via an explicit setscheduler() syscall or an OOM, the task can't run at all. In short, the oom killer doesn't work at all if admins are using cpu cgroup and don't touch the rtruntime knob. Eventually, kernel may hang up when oom kill occur. I and the original author Luis agreed to disable this logic. Signed-off-by: KOSAKI Motohiro <[email protected]> Acked-by: Luis Claudio R. Goncalves <[email protected]> Acked-by: KAMEZAWA Hiroyuki <[email protected]> Reviewed-by: Minchan Kim <[email protected]> Acked-by: David Rientjes <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 929bea7 commit 341aea2

File tree

1 file changed

+0
-28
lines changed

1 file changed

+0
-28
lines changed

mm/oom_kill.c

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -83,24 +83,6 @@ static bool has_intersects_mems_allowed(struct task_struct *tsk,
8383
}
8484
#endif /* CONFIG_NUMA */
8585

86-
/*
87-
* If this is a system OOM (not a memcg OOM) and the task selected to be
88-
* killed is not already running at high (RT) priorities, speed up the
89-
* recovery by boosting the dying task to the lowest FIFO priority.
90-
* That helps with the recovery and avoids interfering with RT tasks.
91-
*/
92-
static void boost_dying_task_prio(struct task_struct *p,
93-
struct mem_cgroup *mem)
94-
{
95-
struct sched_param param = { .sched_priority = 1 };
96-
97-
if (mem)
98-
return;
99-
100-
if (!rt_task(p))
101-
sched_setscheduler_nocheck(p, SCHED_FIFO, &param);
102-
}
103-
10486
/*
10587
* The process p may have detached its own ->mm while exiting or through
10688
* use_mm(), but one or more of its subthreads may still have a valid
@@ -452,13 +434,6 @@ static int oom_kill_task(struct task_struct *p, struct mem_cgroup *mem)
452434
set_tsk_thread_flag(p, TIF_MEMDIE);
453435
force_sig(SIGKILL, p);
454436

455-
/*
456-
* We give our sacrificial lamb high priority and access to
457-
* all the memory it needs. That way it should be able to
458-
* exit() and clear out its resources quickly...
459-
*/
460-
boost_dying_task_prio(p, mem);
461-
462437
return 0;
463438
}
464439
#undef K
@@ -482,7 +457,6 @@ static int oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order,
482457
*/
483458
if (p->flags & PF_EXITING) {
484459
set_tsk_thread_flag(p, TIF_MEMDIE);
485-
boost_dying_task_prio(p, mem);
486460
return 0;
487461
}
488462

@@ -556,7 +530,6 @@ void mem_cgroup_out_of_memory(struct mem_cgroup *mem, gfp_t gfp_mask)
556530
*/
557531
if (fatal_signal_pending(current)) {
558532
set_thread_flag(TIF_MEMDIE);
559-
boost_dying_task_prio(current, NULL);
560533
return;
561534
}
562535

@@ -712,7 +685,6 @@ void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask,
712685
*/
713686
if (fatal_signal_pending(current)) {
714687
set_thread_flag(TIF_MEMDIE);
715-
boost_dying_task_prio(current, NULL);
716688
return;
717689
}
718690

0 commit comments

Comments
 (0)