From: Alexey Dobriyan <adobriyan@gmail.com>
To: Charles Haithcock <chaithco@redhat.com>
Cc: trivial@kernel.org, akpm@linux-foundation.org,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH net-next] mm, oom: keep oom_adj under or at upper limit when printing
Date: Tue, 20 Oct 2020 13:04:42 +0300 [thread overview]
Message-ID: <20201020100442.GA4797@localhost.localdomain> (raw)
In-Reply-To: <20201019215229.225386-1-chaithco@redhat.com>
On Mon, Oct 19, 2020 at 03:52:29PM -0600, Charles Haithcock wrote:
> 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.
> --- a/fs/proc/base.c
> +++ b/fs/proc/base.c
> @@ -1048,6 +1048,8 @@ static ssize_t oom_adj_read(struct file *file, char __user *buf, size_t count,
> else
> oom_adj = (task->signal->oom_score_adj * -OOM_DISABLE) /
> OOM_SCORE_ADJ_MAX;
> + if (oom_adj > OOM_ADJUST_MAX)
> + oom_adj = OOM_ADJUST_MAX;
> put_task_struct(task);
Should be done after PUT so that task is put as early as possible.
> len = snprintf(buffer, sizeof(buffer), "%d\n", oom_adj);
> return simple_read_from_buffer(buf, count, ppos, buffer, len);
prev parent reply other threads:[~2020-10-20 10:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-19 21:52 [PATCH net-next] mm, oom: keep oom_adj under or at upper limit when printing Charles Haithcock
2020-10-20 10:04 ` Alexey Dobriyan [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201020100442.GA4797@localhost.localdomain \
--to=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=chaithco@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=trivial@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).