forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OOM killer might be triggered externally via sysrq+f. This is supposed to kill a task no matter what e.g. a task is selected even though there is an OOM victim on the way to exit. This is a big hammer for an admin to help to resolve a memory short condition when the system is not able to cope with it on its own in a reasonable time frame (e.g. when the system is trashing or the OOM killer cannot make sufficient progress). The forced OOM killing is currently wired into out_of_memory() call which is kind of ugly because generic out_of_memory path has to deal with configuration settings and heuristics which are completely irrelevant to the forced OOM killer (e.g. sysctl_oom_kill_allocating_task or OOM killer prevention for already dying tasks). Some of those will not apply to sysrq because the handler runs from the worker context. check_panic_on_oom on the other hand will work and that is kind of unexpected because sysrq+f should be usable to kill a mem hog whether the global OOM policy is to panic or not. It also doesn't make much sense to panic the system when no task cannot be killed because admin has a separate sysrq for that purpose. Let's pull forced OOM killer code out into a separate function (force_out_of_memory) which is really trivial now. Also extract the core of oom_kill_process into __oom_kill_process which doesn't do any OOM prevention heuristics. As a bonus we can clearly state that this is a forced OOM killer in the OOM message which is helpful to distinguish it from the regular OOM killer. Signed-off-by: Michal Hocko <[email protected]> Cc: David Rientjes <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
- Loading branch information
Showing
4 changed files
with
58 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters