Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1282134yba; Fri, 26 Apr 2019 18:17:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqxdncpiNrWwdzaS2FzV4BtFZz7fDC0hLr4+Od/MaDOI4DOZGbHedL+WBiW6veDdmjPipHpA X-Received: by 2002:a17:902:a5cb:: with SMTP id t11mr20110208plq.268.1556327863116; Fri, 26 Apr 2019 18:17:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556327863; cv=none; d=google.com; s=arc-20160816; b=wr7Zxr119PYJWwDsdPsZIBsWFJxEAuiQOk9jUgJc0yh4/yVenMB8G94hm7U8L7cRKu gc5oZXYMgLzt+QKKPOexOzHA0xRpeXTtqOQpK71u9YfhAj1awLuAqL7J6cro5i0joyrS RQ8NA5hnH2yi8iWdMyns2dBs5OzMhHNntXqenY+fqCyd7osdmPofpn3gWw5mMM++YWD6 lolOuCPT4IDJNaJvT0Di4KMiJaEUHQahaT1O9aGlFXYqrNq5Gtjfis7B7ESSnue2EiwQ g8DDMgGCA0hXC5rDBdOm/Gltt5DLq+fUSL9wxZKJqliWwfBd2A+9nXNCAuCmd8mZv0KD 1eDw== 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=kkcfSN7OQYxQP9Osi2yXJo0DJsovIP9YNH2dLOXJN6M=; b=ru495jHBFFRbyV1p5KYU5rARDncAPn99EYtQbKQLFyOdCs8h84ve3QtzGbl0GeaoTD iCfWbVxNkx47Geg6tKH0Tq3uxikhUmr2bn4c4ofBrjXJXVwlfW3MYMlzLAdMhJopzZkh ySIiePBC6mIgJ8ML5+zHzxSeKcu79VYzs5QZPmjvg3oMNEV3XA3SyBlesRGg5vUBhJx1 9xbeMF0DJcjWeZH17dRz6VDt9pVDu20WdO4y1tGzSDZQqYghnUzrdFPkAUaSTbsP9rWT FTc0DYyJMr8HEulYkPA4HZQ3ooSxIw0pMc3tgQ/8hKLnul5Sa8yeoC4nsTheCu+UqY6h j2UA== 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 f12si24780477pgo.388.2019.04.26.18.17.15; Fri, 26 Apr 2019 18:17:43 -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 S1727224AbfD0BPu (ORCPT + 99 others); Fri, 26 Apr 2019 21:15:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49824 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726974AbfD0BPu (ORCPT ); Fri, 26 Apr 2019 21:15:50 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0C19D30BCD74 for ; Sat, 27 Apr 2019 01:15:50 +0000 (UTC) Received: from x230.aquini.net (ovpn-120-14.rdu2.redhat.com [10.10.120.14]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A28695C21F; Sat, 27 Apr 2019 01:15:47 +0000 (UTC) Date: Fri, 26 Apr 2019 21:15:45 -0400 From: Rafael Aquini To: Joel Savitz Cc: linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] mm/oom_killer: Add task UID to info message on an oom kill Message-ID: <20190427011545.GA10398@x230.aquini.net> References: <1556305197-1600-1-git-send-email-jsavitz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1556305197-1600-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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Sat, 27 Apr 2019 01:15:50 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 26, 2019 at 02:59:57PM -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 > > 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