Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5974924ybi; Wed, 12 Jun 2019 11:41:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqyzfLOMChK7vdmIlWaa0L6YzrJD3qwRGpw9QETHwo4FIxK13M+2JkTVYPBPIR6ons1eCsrg X-Received: by 2002:a17:902:760f:: with SMTP id k15mr58487945pll.125.1560364899667; Wed, 12 Jun 2019 11:41:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560364899; cv=none; d=google.com; s=arc-20160816; b=GwhpSqfIvqoK1NgXT4wbllVeCMRnanfZPnfGG8WXqjpVotEy4F1jSmVCk3I79e0xhc e3Lmc5I8Q4+g5nwXEyV0eAuHZ66ampd9i0oYxO0BJq3Uruekc5BUektCPuvbRAwMowr7 UmtLdLvJ0M3HyVZjzhbzk9CUlJUgzqv8ZwdXNdGN31+YaUklGRy4QRfH3ejWCWGCX2uO v5XogftSv9S5Y/rzVt+IdglD6Nkp4Co4fyr2OhngayOjyMZzGU0tk9UfpPok+h4MoREI VOdO0FBQzar54hSSKDQU75HhJ5Gp9a4HyqVtyaya1E2NJy4S6L0nIs7ZuFC9CoqH89Zo oapg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=MAEdGWtMT+73VzWnKUa2R//cIsfAOphq8gc0YAftk3c=; b=BL5i+6nJCLrhrfBI5eWnxaGd4/4kW1Lp9u6Cw8n5fauN7NbpZ2ARzphtWJXznDOXhJ tjqdDUqn4VJPS+9TTAX0IOlaX13yBUisaN2POQaxPgGQPE4wuVI/KfSI5NuwTE4uZ5p+ vPyH+KJcLI3LmYJPrgwbiW45kRY/hw8fBXjk9B1ktLdkAvFwBxr32rNRh9K5lzcNLmuF /y5H49vKE+hBxjPcnj4rAYTmBKy4yTFSEFVRF0OdCNsGaKWv71Ic3jtvu2X3ly8QSmOY MK54o/C9O/4N0oia3Mi0eUHl3vuAYirKdmxKaQSGCjhwbxRxvVT6ecY4rsiPazDfpQmB cFow== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v11si535384pjn.44.2019.06.12.11.41.25; Wed, 12 Jun 2019 11:41:39 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728442AbfFLSkg (ORCPT + 99 others); Wed, 12 Jun 2019 14:40:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51962 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726724AbfFLSke (ORCPT ); Wed, 12 Jun 2019 14:40:34 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E62313082A9B; Wed, 12 Jun 2019 18:40:28 +0000 (UTC) Received: from x230.aquini.net (dhcp-17-61.bos.redhat.com [10.18.17.61]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4CA6B6015E; Wed, 12 Jun 2019 18:40:28 +0000 (UTC) Date: Wed, 12 Jun 2019 14:40:26 -0400 From: Rafael Aquini To: Joel Savitz Cc: linux-kernel@vger.kernel.org, Andrew Morton , 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: <20190612184026.GD5313@x230.aquini.net> References: <1560362273-534-1-git-send-email-jsavitz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1560362273-534-1-git-send-email-jsavitz@redhat.com> User-Agent: Mutt/1.11.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Wed, 12 Jun 2019 18:40:34 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 12, 2019 at 01:57:53PM -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 > > > Suggested-by: David Rientjes > Signed-off-by: Joel Savitz > --- > mm/oom_kill.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/mm/oom_kill.c b/mm/oom_kill.c > index 3a2484884cfd..af2e3faa72a0 100644 > --- a/mm/oom_kill.c > +++ b/mm/oom_kill.c > @@ -874,12 +874,13 @@ static void __oom_kill_process(struct task_struct *victim, const char *message) > */ > 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\n", > + pr_err("%s: Killed process %d (%s) total-vm:%lukB, anon-rss:%lukB, file-rss:%lukB, shmem-rss:%lukB, UID %d\n", > message, task_pid_nr(victim), victim->comm, > K(victim->mm->total_vm), > K(get_mm_counter(victim->mm, MM_ANONPAGES)), > K(get_mm_counter(victim->mm, MM_FILEPAGES)), > - K(get_mm_counter(victim->mm, MM_SHMEMPAGES))); > + K(get_mm_counter(victim->mm, MM_SHMEMPAGES)), > + from_kuid(&init_user_ns, task_uid(victim))); > task_unlock(victim); > > /* > -- > 2.18.1 > Acked-by: Rafael Aquini