Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp527304ybl; Wed, 21 Aug 2019 01:14:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqwKlg9Kg/T4R9A0WojPKlLmiuM8+EuyPi1o/2gk1YCQ9J5n7jqBeq2tpcsi4SDc6bvfry/Y X-Received: by 2002:a17:90a:dc82:: with SMTP id j2mr4150038pjv.89.1566375252947; Wed, 21 Aug 2019 01:14:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566375252; cv=none; d=google.com; s=arc-20160816; b=CnWmbDCWbTs4HzVOTIvOYwJjiM3HrmsRtLiZhdH9eN3tUm5Io/07tRflnzm22/qjRL dR4EIsGFYofqLmv6GnYEzrpvOaD6RcIbj4V0dRe2xmCupbqpsgQqAoUHa6/39w/xP8Rw aCRHSQpEJRWhmwc1IF6KQR8uBcqkUWibIi/AdrmrBDcb3HGxNJ/xZeegFAorzE9dpha9 Us0PKcXjdwiTHc9FWLf21CCQMVkUHBoK1tbt+Gz+/2fanznkmbhgnTA955dA/xlm0u12 Zy1YLBC7ID8/vPT5Ksza6PsjSYQ/3IcrRRNWN9r5FIEZE4fnMXaVxeJA+PwlGWerC8Ob W9fQ== 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=jq2YV2JP+Wp3NuNxDHKT9RYl9qpDojYks9ZVdzwiE20=; b=GLPiCvlpCelMwBjS14IgtooE28GdDA+qaeVH5afRvtFz8s0fQECa04Uc72YqDdwaJa 7tAThFTAzSTuAEXSxuUxDV83cuDvwOSpV0jqPC0UtuqZbBwz+KrIfnxWFYzSpVAp+tPg fiTJEAZCqLNC1PJJH8m2avxwXBxASvDm1UEmdslNqEn/uF6q0V31YqqWaF8E3LZW2fhj eOeQz6KvdVa09Gk1svIs7cQGFbaScQXRDTLULu4klBCH4CP22suU7tJpxQQ1hYatBBvi XKhIUVGXHe6Uqn/QSFtXjb/VF2+dOkbo0QPXHwci7LKjJ9We/sEK1zEQxoNJUstMiSvK YD/g== 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 30si1863772pjz.30.2019.08.21.01.13.55; Wed, 21 Aug 2019 01:14:12 -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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727725AbfHUHrZ (ORCPT + 99 others); Wed, 21 Aug 2019 03:47:25 -0400 Received: from mx2.suse.de ([195.135.220.15]:36352 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726224AbfHUHrZ (ORCPT ); Wed, 21 Aug 2019 03:47:25 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id A4FBCB027; Wed, 21 Aug 2019 07:47:23 +0000 (UTC) Date: Wed, 21 Aug 2019 09:47:21 +0200 From: Michal Hocko To: David Rientjes Cc: Edward Chron , Andrew Morton , Roman Gushchin , Johannes Weiner , Tetsuo Handa , Shakeel Butt , linux-mm@kvack.org, linux-kernel@vger.kernel.org, colona@arista.com Subject: Re: [PATCH] mm/oom: Add oom_score_adj value to oom Killed process message Message-ID: <20190821074721.GY3111@dhcp22.suse.cz> References: <20190821001445.32114-1-echron@arista.com> <20190821064732.GW3111@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 21-08-19 00:19:37, 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(). I believe that the motivation was to have a one line summary that is already parsed by log consumers. And that is in __oom_kill_process one. Also I do not think this patch improves things much for two reasons at leasts a) it doesn't really give you the whole list of killed tasks (this might be the whole memcg) and b) we already do have most important information in __oom_kill_process. If something is missing there I do not see a strong reason we cannot add it there. Like in this case. > 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); > } -- Michal Hocko SUSE Labs