Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp169162ybl; Wed, 21 Aug 2019 16:58:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqykDR4ad3CSM3VZLz9uMkYCM9kiYrMFKNVnschRXWOnITYD4KvkFKceLITuHEwR5kAKmMw1 X-Received: by 2002:a65:64ce:: with SMTP id t14mr9917217pgv.137.1566431918219; Wed, 21 Aug 2019 16:58:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566431918; cv=none; d=google.com; s=arc-20160816; b=EYH1ENLiGPnOU8ZICtCy2+woPFzHG8aY/OpSaI9CJ4dOqO2Ln2Esf4+uzzHgQp2ZLP L8TKoyFV0FBX/PZf05mEmLrdS+F9tSBUvrodg0K0/23Y0r5MAW0Y3ngIGSyMjEcithHK y3s8XBhJxs8ewrIjZ/PCbj550j9hRPxLs2/PGCxPboII7XAZjswOfknpmF8oqOuWH9y1 2R6gb++nvGe+aO7sBlAgzd/88G3DIJ1Qdo70t9B/4uW3I/dr5Y/KWYh/wGCvz1rQgRF/ q0IyzLOlvrPNlqsep2JF4je2ZsopckSAdfyiSfnMf3OutCCy53WP3R0UBGf15QaHqb6M R/vQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=1n1EqLNQaVBykjrc6gwB/kJFS9Ls04rvVpImZ/x3es0=; b=qrydQUHvT14LswLl1mu+V5NF6lY/qmv1vD6V/WPl8FHNdU0kFor6SAk3xOTrSiTUDe V4zX+nT9RwhsfvLD2Bng2OqHZ8VoUjuV3IJM0eUGWiBb3lS84A1pyOm+JZPS1WIU3osV Clc9cm9tSZymvB36nJ42iDr9pL6KR1+fQNYK4npMqDy82BwTufwXTBL78L9PTJeLNeee RCJsXVvlh00467DHJ3ac7CN6JuzEb8sWO853dNUtnYH5+0UnbRAH6ZKUi7IYsS51VzUa EH9YdRFMlNfWGNXXoPrna1VWILwDL24+0bXR/dFeoulKdPjUSVYEBtu0onJn27XY4vs9 MFaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arista.com header.s=googlenew header.b=CYsF6BJG; 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=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=arista.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x18si6906924pff.208.2019.08.21.16.58.22; Wed, 21 Aug 2019 16: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=@arista.com header.s=googlenew header.b=CYsF6BJG; 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=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=arista.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731118AbfHUWWU (ORCPT + 99 others); Wed, 21 Aug 2019 18:22:20 -0400 Received: from mail-io1-f67.google.com ([209.85.166.67]:36860 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731104AbfHUWWT (ORCPT ); Wed, 21 Aug 2019 18:22:19 -0400 Received: by mail-io1-f67.google.com with SMTP id o9so7926441iom.3 for ; Wed, 21 Aug 2019 15:22:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arista.com; s=googlenew; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=1n1EqLNQaVBykjrc6gwB/kJFS9Ls04rvVpImZ/x3es0=; b=CYsF6BJGJdSPA7AbVCKU7VpXyzx9FVJZzR3CqqYlqbawduDvrFSyZo6ah0QQ6MHy9A qAqzbTq6NujyUK4lznGOC3JS0N/DJegldMLMpihJ7TPdki7dqCRPgxGMCcuwqBuFIbgv 1bcaZPiwfAjo7aaoIbJ8Sn/udLpisl62i8aXL//XnSpvoIg3VuQIIaeymrcwdBeQxr7D 7OskJ2JihhelcLKVLvUbePycluFv3HcEY2T6yWj9JSJveiM9fDr8/7woLK+QlNdeqf2J QEjpkA2taXlg+ai+QRi51Q4S0I1VImxTfSdYxmBKxA6UXk7PKKIMCjS9e4HuhGQzwFSq a0Jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=1n1EqLNQaVBykjrc6gwB/kJFS9Ls04rvVpImZ/x3es0=; b=dFGHhcBcFU+2oDXcxK5Huw35/+OOqV85pJBl0XUX07tJYMu+zCghb/TkZoKCBWgl7k Q1C7SQVMVmcXv9tSHAmLY2RziKcQ3mRf10iqRwBOFtR5XoUq02WUHRIHLHTgFGsxcPMe XAy4WQwnCkkbZf0Gj97E9RiJiGYPxKGyTf7dDmXGXRR6VenWBZKOcdrBcjm6MfOCHZIf kx17hpXvjfiGxXMMwnQqERRt9qlhmrE1R8f/G9kvz69FBpUyqtfT4TF63mBQzpdtV8dA RWWP/kqTCjcfXqiuHnXMQyBfr3jT3U+1iL31WgLi303qK+gYT4DPes5MUP/iVsfPcIwF p3Sg== X-Gm-Message-State: APjAAAVIvtmfYghRIvQHjBrJJuM53TG9xyf0IcJyvxJ5x8yN+8R4zE0f YbkSd+5Ev0iKd4niT0eH/ylHOcq1NKARX60ZcPQkfw== X-Received: by 2002:a5d:8484:: with SMTP id t4mr7355672iom.5.1566426138770; Wed, 21 Aug 2019 15:22:18 -0700 (PDT) MIME-Version: 1.0 References: <20190821001445.32114-1-echron@arista.com> <20190821064732.GW3111@dhcp22.suse.cz> In-Reply-To: From: Edward Chron Date: Wed, 21 Aug 2019 15:22:07 -0700 Message-ID: Subject: Re: [PATCH] mm/oom: Add oom_score_adj value to oom Killed process message To: David Rientjes Cc: Michal Hocko , Andrew Morton , Roman Gushchin , Johannes Weiner , Tetsuo Handa , Shakeel Butt , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Ivan Delalande Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 21, 2019 at 12:19 AM David Rientjes wrote: > > On Wed, 21 Aug 2019, Michal Hocko wrote: > > > > vm.oom_dump_tasks is pretty useful, however, so it's curious why you > > > haven't left it enabled :/ > > > > Because it generates a lot of output potentially. Think of a workload > > with too many tasks which is not uncommon. > > Probably better to always print all the info for the victim so we don't > need to duplicate everything between dump_tasks() and dump_oom_summary(). > > Edward, how about this? > > diff --git a/mm/oom_kill.c b/mm/oom_kill.c > --- a/mm/oom_kill.c > +++ b/mm/oom_kill.c > @@ -420,11 +420,17 @@ static int dump_task(struct task_struct *p, void *arg) > * State information includes task's pid, uid, tgid, vm size, rss, > * pgtables_bytes, swapents, oom_score_adj value, and name. > */ > -static void dump_tasks(struct oom_control *oc) > +static void dump_tasks(struct oom_control *oc, struct task_struct *victim) > { > pr_info("Tasks state (memory values in pages):\n"); > pr_info("[ pid ] uid tgid total_vm rss pgtables_bytes swapents oom_score_adj name\n"); > > + /* If vm.oom_dump_tasks is disabled, only show the victim */ > + if (!sysctl_oom_dump_tasks) { > + dump_task(victim, oc); > + return; > + } > + > if (is_memcg_oom(oc)) > mem_cgroup_scan_tasks(oc->memcg, dump_task, oc); > else { > @@ -465,8 +471,8 @@ static void dump_header(struct oom_control *oc, struct task_struct *p) > if (is_dump_unreclaim_slabs()) > dump_unreclaimable_slab(); > } > - if (sysctl_oom_dump_tasks) > - dump_tasks(oc); > + if (p || sysctl_oom_dump_tasks) > + dump_tasks(oc, p); > if (p) > dump_oom_summary(oc, p); > } I would be willing to accept this, though as Michal mentions in his post, it would be very helpful to have the oom_score_adj on the Killed process message. One reason for that is that the Killed process message is the one message that is printed with error priority (pr_err) and so that message can be filtered out and sent to notify support that an OOM event occurred. Putting any information that can be shared in that message is useful from my experience as it the initial point of triage for an OOM event. Even if the full log with per user process is available it the starting point for triage for an OOM event. So from my perspective I would be happy having both, with David's proposal providing a bit of extra information as shown here: Jul 21 20:07:48 linuxserver kernel: [ pid ] uid tgid total_vm rss pgtables_bytes swapents oom_score_adj name Jul 21 20:07:48 linuxserver kernel: [ 547] 0 547 31664 615 299008 0 0 systemd-journal The OOM Killed process message will print as: Jul 21 20:07:48 linuxserver kernel: Out of memory: Killed process 2826 (oomprocs) total-vm:1056800kB, anon-rss:1052784kB, file-rss:4kB, shmem-rss:0kB oom_score_adj:1000 But if only one one output change is allowed I'd favor the Killed process message since that can be singled due to it's print priority and forwarded. By the way, right now there is redundancy in that the Killed process message is printing vm, rss even if vm.oom_dump_tasks is enabled. I don't see why that is a big deal. It is very useful to have all the information that is there. Wouldn't mind also having pgtables too but we would be able to get that from the output of dump_task if that is enabled. If it is acceptable to also add the dump_task for the killed process for !sysctl_oom_dump_tasks I can repost the patch including that as well. Thank-you, Edward Chron Arista Networks