From: Andrew Morton <akpm@linux-foundation.org>
To: Joel Savitz <jsavitz@redhat.com>
Cc: linux-kernel@vger.kernel.org, Rafael Aquini <aquini@redhat.com>,
David Rientjes <rientjes@google.com>,
linux-mm@kvack.org
Subject: Re: [RESEND PATCH v2] mm/oom_killer: Add task UID to info message on an oom kill
Date: Wed, 12 Jun 2019 18:00:31 -0700 [thread overview]
Message-ID: <20190612180031.e9314711c9d0c77ba915d977@linux-foundation.org> (raw)
In-Reply-To: <1560362273-534-1-git-send-email-jsavitz@redhat.com>
On Wed, 12 Jun 2019 13:57:53 -0400 Joel Savitz <jsavitz@redhat.com>
wrote:
> In the event of an oom kill, useful information about the killed
> process is printed to dmesg. Users, especially system administrators,
> will find it useful to immediately see the UID of the process.
>
> In the following example, abuse_the_ram is the name of a program
> that attempts to iteratively allocate all available memory until it is
> stopped by force.
>
> Current message:
>
> Out of memory: Killed process 35389 (abuse_the_ram)
> total-vm:133718232kB, anon-rss:129624980kB, file-rss:0kB,
> shmem-rss:0kB
>
> Patched message:
>
> Out of memory: Killed process 2739 (abuse_the_ram),
> total-vm:133880028kB, anon-rss:129754836kB, file-rss:0kB,
> shmem-rss:0kB, UID 0
The other fields are name:value so it seems better to make the UID
field conform.
Also, there's no typesafe way of printing a uid_t (using the printk %p trick)
so yes, we have to assume its type. But assuming unsigned int is
better than assuming int!
So...
s/UID %d/UID:%u/ in printk
--- a/mm/oom_kill.c~mm-oom_killer-add-task-uid-to-info-message-on-an-oom-kill-fix
+++ a/mm/oom_kill.c
@@ -876,7 +876,7 @@ static void __oom_kill_process(struct ta
*/
do_send_sig_info(SIGKILL, SEND_SIG_PRIV, victim, PIDTYPE_TGID);
mark_oom_victim(victim);
- pr_err("%s: Killed process %d (%s) total-vm:%lukB, anon-rss:%lukB, file-rss:%lukB, shmem-rss:%lukB, UID %d\n",
+ pr_err("%s: Killed process %d (%s) total-vm:%lukB, anon-rss:%lukB, file-rss:%lukB, shmem-rss:%lukB, UID:%u\n",
message, task_pid_nr(victim), victim->comm,
K(victim->mm->total_vm),
K(get_mm_counter(victim->mm, MM_ANONPAGES)),
_
next prev parent reply other threads:[~2019-06-13 1:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-12 17:57 [RESEND PATCH v2] mm/oom_killer: Add task UID to info message on an oom kill Joel Savitz
2019-06-12 18:40 ` Rafael Aquini
2019-06-13 1:00 ` Andrew Morton [this message]
2019-06-13 8:23 ` Michal Hocko
2019-09-21 0:13 ` Andrew Morton
2019-09-21 1:00 ` Rafael Aquini
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=20190612180031.e9314711c9d0c77ba915d977@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=aquini@redhat.com \
--cc=jsavitz@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rientjes@google.com \
/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).