Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1329843ybl; Thu, 22 Aug 2019 12:46:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqwzsaDeIcvH6hwwhaXkYz2sxJ3iJbU3YLnyaMwIPJ5umg+53EnIQwPCrzk15RXjbOr/Dpr5 X-Received: by 2002:a65:6846:: with SMTP id q6mr803523pgt.150.1566503194354; Thu, 22 Aug 2019 12:46:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566503194; cv=none; d=google.com; s=arc-20160816; b=XSyqmHWK3CZJgvJGNbzv4YFKNWdQVx+CiP9jqZALf41Ne5NYsDwnInxXkNxyIdUaj+ /3BwuXIEbEKlQRx21wesyUQpZPtl2RYk3XkwsHlF3PC/IGk14Z2PdgQ76GhfVqp1RCjI y5TpZotU25aU1N3Kt2OwhzUDTTYeLJuJh5fF4MwEI1XGQhalZ21Gn/YLTkqIBJHqSZif RARhuvDnBAtSdicZYj0vqSaHFyr5I4xNN8EQu1WhBePFsyEErP/aG21xL/YQxHSOuugR k1iUjeeA/oBK6TsX5IQQ0Usow2Nh4e0F2Kw0cBICKR+JUaOYTeKAh6Mdx+qi+XYPmPaK gXRg== 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=ucbMC5erml7tFi/vSKgs7cW+rQvFN8BeI/aLj2HiGCA=; b=k1tBm3we9sTi7492QTR/R2hW5mFseT9Bes6aWUr1UBNDnNi+MCVADF8Vm5qWI9EiRg Fjo93bT3dzYh7wLZzzBwyuqXewYHiCupTo5oE+ABD4KgB1RB9Vx4BJl38wTMcRWsfZSg v9sO/7thiE/Xj0L78WOQhWuMaeWcfqN/sHgQf/GIsQ014H2hmpOQ+vCJpO6gUzgPm6sL l25IbDukyczkjzwBcvZQH+QTzu58uHhEByzk0S91WmJI7L2JLIIkLnTYTBA8BVIJBNyY 4Nq3jLVu7vqJdbzllj4ef3h/rqvrOpzdO1PEl3V5MLSFxP92yE/7qzm5PmGv/nYK8/7u /YFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arista.com header.s=googlenew header.b=YZYTmMTT; 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 g1si358107plt.296.2019.08.22.12.46.18; Thu, 22 Aug 2019 12:46:34 -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=YZYTmMTT; 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 S2389515AbfHVPSr (ORCPT + 99 others); Thu, 22 Aug 2019 11:18:47 -0400 Received: from mail-io1-f65.google.com ([209.85.166.65]:43675 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732532AbfHVPSr (ORCPT ); Thu, 22 Aug 2019 11:18:47 -0400 Received: by mail-io1-f65.google.com with SMTP id 18so12540034ioe.10 for ; Thu, 22 Aug 2019 08:18:47 -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=ucbMC5erml7tFi/vSKgs7cW+rQvFN8BeI/aLj2HiGCA=; b=YZYTmMTTAUoOOm7zx6b8VkiKIgXdfcyNMBNzJf1Tp1aK74EHJ6WpyOPgC8F7mErT9y CdjdKGw80pxYRkvnrKtEbdPeKVcUxu46hvc/UoO0h5Id0XFLumdbv99KM/mujNRftI6p Qvj4MPl2Usvr1Wm5DhDc4gwPnXB2xFvT4IJvx/Ygq8gTldqRtXqgxJ9W68Vrd3O8AA/a 2DlkVF13FqTrH13tM2JPhppfC+YzRfUmpB7HEJWNIi+6RF6byJeicuzlWa6cEYCW4N3p F8xoBxrOBkG2uUCT0Hyas8VCHzh1gidg+7iaSJ8qn0XFKig9EwRQ4wPAjvLBEhEGaIZ8 C87Q== 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=ucbMC5erml7tFi/vSKgs7cW+rQvFN8BeI/aLj2HiGCA=; b=PMs2ppS+PFtg14oKWfg8/btY/OWGrQUQeS1pmIfCPTS2bxKODErDbfhECT9FbH9NPo kSQlipNeK6KDVob1c0c7oTrw3KgA4UaUEUwxgAQp7YwF7p2MbkUD85GXOf+HtZCObury xEZjm1SRpvUsQyJnMZL6M5k0HOQKM8lZwBGkLFlKfvkKIIcRQmSFPPIDE7rGHjf8thxv hEwuTxm+3GUsoylBAqXQ5ukIfXCydZI7H0WBmRd7naq5xgm0Fxtv2z9jkVS1P5PuENp2 qDfLUOSZjklq3sbcYOqNm2C6pXtsJPdkqbO7azjbjdyr1/xlM2VoOb4ewYXdwh7t+3aD v45w== X-Gm-Message-State: APjAAAVWO4VXhUx/LCba1cdWSIpQu4xUCPwjmAhOr8cEe3x170XRGPQ+ bNCmHbHENZZibAoFP//ZnGDZ5ZFqxTj9uRzR2ktAhA== X-Received: by 2002:a02:ba91:: with SMTP id g17mr15990319jao.11.1566487126538; Thu, 22 Aug 2019 08:18:46 -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: Thu, 22 Aug 2019 08:18:35 -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? It is worth mentioning that David's suggested change, while I agree with Michal that it should be a separate issue from updating the OOM Killed process message, certainly has merit. Though, it's not strictly necessary for what I was asking for. If you have scripts that scan your logs from OOM events, having a regular format to OOM output makes parsing easier. With David's suggestion there would always be a "Tasks state" section and the vm.oom_dump_tasks still works but it just prevents all the tasks from being dumped not from dumping the killed process. OOM output was reorganized not that long ago as we discussed earlier to provide improved organization of data, so this proposal would be in line with that change. If there is interest in this I can submit a separate patch submission. > > 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); > }