aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc/base.c
diff options
context:
space:
mode:
authorCharles Haithcock <chaithco@redhat.com>2020-11-01 17:07:56 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2020-11-02 12:14:19 -0800
commit66606567dedf395e0857f531976efad4cbbd39ea (patch)
tree3314ef554731de6cb840c181bf96d4158820a4cd /fs/proc/base.c
parentkthread_worker: prevent queuing delayed work from timer_fn when it is being canceled (diff)
downloadlinux-dev-66606567dedf395e0857f531976efad4cbbd39ea.tar.xz
linux-dev-66606567dedf395e0857f531976efad4cbbd39ea.zip
mm, oom: keep oom_adj under or at upper limit when printing
For oom_score_adj values in the range [942,999], the current calculations will print 16 for oom_adj. This patch simply limits the output so output is inline with docs. Signed-off-by: Charles Haithcock <chaithco@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Acked-by: Michal Hocko <mhocko@suse.com> Cc: Alexey Dobriyan <adobriyan@gmail.com> Link: https://lkml.kernel.org/r/20201020165130.33927-1-chaithco@redhat.com Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/proc/base.c')
-rw-r--r--fs/proc/base.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 0f707003dda5..b362523a9829 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -1049,6 +1049,8 @@ static ssize_t oom_adj_read(struct file *file, char __user *buf, size_t count,
oom_adj = (task->signal->oom_score_adj * -OOM_DISABLE) /
OOM_SCORE_ADJ_MAX;
put_task_struct(task);
+ if (oom_adj > OOM_ADJUST_MAX)
+ oom_adj = OOM_ADJUST_MAX;
len = snprintf(buffer, sizeof(buffer), "%d\n", oom_adj);
return simple_read_from_buffer(buf, count, ppos, buffer, len);
}