Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp7123189ybi; Thu, 13 Jun 2019 09:58:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqxsDBZutibj6FKjbS1zsXK+qiBIMLsWOdNZf6B1VLOlxcAJatfiXzZHN6jBXCkF5Yfnlj8P X-Received: by 2002:a63:e60b:: with SMTP id g11mr11396942pgh.172.1560445118955; Thu, 13 Jun 2019 09:58:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560445118; cv=none; d=google.com; s=arc-20160816; b=UB0lmP8NWGKXRjAvL3hKOCc0OTC1kIz01rJMw+64+XZSC2CdBz3txWCvdztZgo8CKB Bnr6jFfVFqPdE97/SkbkI/CFGphqJSlwjr2xUZqdYbIbf1pF8XfuxrRpRQSywX6oH44A PXYKEs6FeYgS9Hsw/We2fzta+a3rahHjGg+864M5j9Y9Gs6LAqX4pLJzMZhDSArKwQ1H 0KQ9BE7GrmlXpnlS3VNsuGDYrV7hgdbrr4uZZu+cBepOP2CYcMyJ9Ty+xGZ6kWw/BpSx DIDmru7VXdbUudiuiM70lWW+bdWcpu6+ReAa25GPL+jLvTVSl1P97ZU6MBU/zBYugCYD YjpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=DarkrN9UGsVxHvmogjtXUy/PWGo8fNu6IG4JYRKrWZM=; b=aZXMNmuXGpReh1UmK8gEc7CBYci0R52URzUc5zVvpDLe2NOEMPU1KCl0PVj+RKU5vg 0twTFTgmux8mL+yZyh9zt+esE5qF5n7tCbnC6H7mxTO4L+OF6ot7srKeh63ji153feI1 +LAsEw4++2Mx7nrAE97vnWUHNq5HHsC3dXFgcH+yTL8/LC2KdhELmUvaTMxpWTyPrejw Zai8fqKV2KVFIaz0N0/8nuveUuYt/KRt42X8xf5Mlb4FKA1kAsIHQgYWqmDdz/UIDNdn 2sAArmn0JDAKlyxbPZoKdNTwNBhCUzpf/GGGIcnmCuS09y/JVawMi7Z7vgReGqywr8t2 dq+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=03XL9DAV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y19si204102pgi.587.2019.06.13.09.58.24; Thu, 13 Jun 2019 09:58:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=03XL9DAV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729919AbfFMQ5m (ORCPT + 99 others); Thu, 13 Jun 2019 12:57:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:58306 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729887AbfFMBAd (ORCPT ); Wed, 12 Jun 2019 21:00:33 -0400 Received: from localhost.localdomain (c-73-223-200-170.hsd1.ca.comcast.net [73.223.200.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 80DD520B7C; Thu, 13 Jun 2019 01:00:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560387632; bh=WUexA2+dp05oChEUY0hVcSnJGehxfowRO2+SZ2+eUDI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=03XL9DAVVWVD08SCihXoCb+VMg14Qe4N0JjLvI2qz6yWLN8k3lI5jhzDJ4oQpOh73 ODhE/FDdjsYf0cN14H2V8IPabHV05TMOWNJnCPwwOCy0nrZ1Q/384BAQ5PcqarQ/gU KnjV1EfqhlRVRJ0s3WFfskPMF5KWnCWHeROGM/ZQ= Date: Wed, 12 Jun 2019 18:00:31 -0700 From: Andrew Morton To: Joel Savitz Cc: linux-kernel@vger.kernel.org, Rafael Aquini , David Rientjes , linux-mm@kvack.org Subject: Re: [RESEND PATCH v2] mm/oom_killer: Add task UID to info message on an oom kill Message-Id: <20190612180031.e9314711c9d0c77ba915d977@linux-foundation.org> In-Reply-To: <1560362273-534-1-git-send-email-jsavitz@redhat.com> References: <1560362273-534-1-git-send-email-jsavitz@redhat.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 12 Jun 2019 13:57:53 -0400 Joel Savitz 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)), _