projects
/
linux-2.6-microblaze.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge tag 'amd-drm-fixes-5.9-2020-08-20' of git://people.freedesktop.org/~agd5f/linux...
[linux-2.6-microblaze.git]
/
mm
/
oom_kill.c
diff --git
a/mm/oom_kill.c
b/mm/oom_kill.c
index
d30ce75
..
e90f25d
100644
(file)
--- a/
mm/oom_kill.c
+++ b/
mm/oom_kill.c
@@
-196,17
+196,17
@@
static bool is_dump_unreclaim_slabs(void)
* predictable as possible. The goal is to return the highest value for the
* task consuming the most memory to avoid subsequent oom failures.
*/
* predictable as possible. The goal is to return the highest value for the
* task consuming the most memory to avoid subsequent oom failures.
*/
-
unsigned
long oom_badness(struct task_struct *p, unsigned long totalpages)
+long oom_badness(struct task_struct *p, unsigned long totalpages)
{
long points;
long adj;
if (oom_unkillable_task(p))
{
long points;
long adj;
if (oom_unkillable_task(p))
- return
0
;
+ return
LONG_MIN
;
p = find_lock_task_mm(p);
if (!p)
p = find_lock_task_mm(p);
if (!p)
- return
0
;
+ return
LONG_MIN
;
/*
* Do not even consider tasks which are explicitly marked oom
/*
* Do not even consider tasks which are explicitly marked oom
@@
-218,7
+218,7
@@
unsigned long oom_badness(struct task_struct *p, unsigned long totalpages)
test_bit(MMF_OOM_SKIP, &p->mm->flags) ||
in_vfork(p)) {
task_unlock(p);
test_bit(MMF_OOM_SKIP, &p->mm->flags) ||
in_vfork(p)) {
task_unlock(p);
- return
0
;
+ return
LONG_MIN
;
}
/*
}
/*
@@
-233,11
+233,7
@@
unsigned long oom_badness(struct task_struct *p, unsigned long totalpages)
adj *= totalpages / 1000;
points += adj;
adj *= totalpages / 1000;
points += adj;
- /*
- * Never return 0 for an eligible task regardless of the root bonus and
- * oom_score_adj (oom_score_adj can't be OOM_SCORE_ADJ_MIN here).
- */
- return points > 0 ? points : 1;
+ return points;
}
static const char * const oom_constraint_text[] = {
}
static const char * const oom_constraint_text[] = {
@@
-310,7
+306,7
@@
static enum oom_constraint constrained_alloc(struct oom_control *oc)
static int oom_evaluate_task(struct task_struct *task, void *arg)
{
struct oom_control *oc = arg;
static int oom_evaluate_task(struct task_struct *task, void *arg)
{
struct oom_control *oc = arg;
-
unsigned
long points;
+ long points;
if (oom_unkillable_task(task))
goto next;
if (oom_unkillable_task(task))
goto next;
@@
-336,12
+332,12
@@
static int oom_evaluate_task(struct task_struct *task, void *arg)
* killed first if it triggers an oom, then select it.
*/
if (oom_task_origin(task)) {
* killed first if it triggers an oom, then select it.
*/
if (oom_task_origin(task)) {
- points =
U
LONG_MAX;
+ points = LONG_MAX;
goto select;
}
points = oom_badness(task, oc->totalpages);
goto select;
}
points = oom_badness(task, oc->totalpages);
- if (
!points
|| points < oc->chosen_points)
+ if (
points == LONG_MIN
|| points < oc->chosen_points)
goto next;
select:
goto next;
select:
@@
-365,6
+361,8
@@
abort:
*/
static void select_bad_process(struct oom_control *oc)
{
*/
static void select_bad_process(struct oom_control *oc)
{
+ oc->chosen_points = LONG_MIN;
+
if (is_memcg_oom(oc))
mem_cgroup_scan_tasks(oc->memcg, oom_evaluate_task, oc);
else {
if (is_memcg_oom(oc))
mem_cgroup_scan_tasks(oc->memcg, oom_evaluate_task, oc);
else {
@@
-863,6
+861,8
@@
static void __oom_kill_process(struct task_struct *victim, const char *message)
p = find_lock_task_mm(victim);
if (!p) {
p = find_lock_task_mm(victim);
if (!p) {
+ pr_info("%s: OOM victim %d (%s) is already exiting. Skip killing the task\n",
+ message, task_pid_nr(victim), victim->comm);
put_task_struct(victim);
return;
} else if (victim != p) {
put_task_struct(victim);
return;
} else if (victim != p) {