Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4141528imm; Thu, 17 May 2018 23:24:02 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoKlIJ/X52HTIYG01DddBapCBjun1wAMLDIJnVU9fIQ+EVXPUr9FCx0gYuFwouaWLXNceuh X-Received: by 2002:a62:cc08:: with SMTP id a8-v6mr8032368pfg.219.1526624642704; Thu, 17 May 2018 23:24:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526624642; cv=none; d=google.com; s=arc-20160816; b=E/0f/TnUcen+KYVU4CFgiReTYcKEU2cd3HvKHVGBdTfO+hq7b6r/ec0446VvtXHsrO p/Is57F9GgnwFzhewjjEThwz1kDfDIR8qH4xyuhd3GC8JV1ZGn1XP3yfz1Itk8/bmcJF FGySIEoOZi8XNCJE/g3CB+5DdgqMYzaRLtLgahfqwo0joOYvVc7kG0vE1s5WKUgcSwv5 N9ZD1LixJ9Zn1IsA9/nw9hDwYCpCume63xw1O1KJQuZoLaCBqVIf6hiFOOh7mOXBPABL 4F1zyCOYhJoNkkcpFC85q1ommpyiGv6vWdL5DhI7I2VW8c0BsDtoYq1bO3lt/uVyI8Yf Bwog== 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:arc-authentication-results; bh=8c7d2ABNIdcu4eiT8UtwqiSt9QJNYT1gkhiIhRyilRI=; b=hztwKoW5eCAh10h9cKA+1kfdOjOz9qb59nWlRyKtolU93Jrx5uk0ShE/BVFn7NKjPs LL/AQkxCY7C6HxD/beLi+JilnbzfWUY6go6yT2sdcFJTSzN/rmu5GOgtBj9MZGB9YXSu T/2AYuR1P3iECWlmSaJlEuUEoqkIcw80+68rw8nho9+vDeMByEdtpSDno9l++bgXmYQN 8PPJMhaeyjUxjPfSbiHyjQhgLuSrw01tohmfK4+ioA8BtljPo+pAplk411RK2CY+MJ1B tC65SmdUF1g65TqC6e/TjMDUTdYmRfbyuanz1PRyTrRzuDMf+JeVUmjf71IaWivcyqGz w2zw== 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 e1-v6si4120805pgp.312.2018.05.17.23.23.48; Thu, 17 May 2018 23:24:02 -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 S1752054AbeERGWS (ORCPT + 99 others); Fri, 18 May 2018 02:22:18 -0400 Received: from mx2.suse.de ([195.135.220.15]:59989 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751979AbeERGWR (ORCPT ); Fri, 18 May 2018 02:22:17 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 322EEACC0; Fri, 18 May 2018 06:22:16 +0000 (UTC) Date: Fri, 18 May 2018 08:22:13 +0200 From: Michal Hocko To: ufo19890607 Cc: akpm@linux-foundation.org, rientjes@google.com, kirill.shutemov@linux.intel.com, aarcange@redhat.com, penguin-kernel@I-love.SAKURA.ne.jp, guro@fb.com, yang.s@alibaba-inc.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, yuzhoujian Subject: Re: [PATCH v2] Print the memcg's name when system-wide OOM happened Message-ID: <20180518062213.GA21711@dhcp22.suse.cz> References: <1526612834-8898-1-git-send-email-ufo19890607@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1526612834-8898-1-git-send-email-ufo19890607@gmail.com> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 18-05-18 04:07:14, ufo19890607 wrote: > From: yuzhoujian > > The dump_header does not print the memcg's name when the system > oom happened. So users cannot locate the certain container which > contains the task that has been killed by the oom killer. System > oom report will contain the memcg's name after this patch. It would be great to mention what you can the name for. > Changes since v1: > - replace adding mem_cgroup_print_oom_info with printing the memcg's > name only. > > Signed-off-by: yuzhoujian > --- > mm/oom_kill.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/mm/oom_kill.c b/mm/oom_kill.c > index 8ba6cb88cf58..b0abb5930232 100644 > --- a/mm/oom_kill.c > +++ b/mm/oom_kill.c > @@ -433,6 +433,9 @@ static void dump_header(struct oom_control *oc, struct task_struct *p) > if (is_memcg_oom(oc)) > mem_cgroup_print_oom_info(oc->memcg, p); > else { > + pr_info("Task in "); > + pr_cont_cgroup_path(task_cgroup(p, memory_cgrp_id)); > + pr_cont(" killed as a result of limit of "); > show_mem(SHOW_MEM_FILTER_NODES, oc->nodemask); > if (is_dump_unreclaim_slabs()) > dump_unreclaimable_slab(); I bet this doesn't compile with CONFIG_MEMCG=n. You either need to put these pr_info lines inside ifdef CONFIG_MEMCG or add helper. The later would reduce code duplication. -- Michal Hocko SUSE Labs