Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3097843imm; Thu, 17 May 2018 03:24:08 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp4Qd8eq9glfeTGSxzr/npQOiZaSlRzrNJFiEFMsn+p4t6UceLRqrBywTpfD1yL4CWvISwZ X-Received: by 2002:a62:3bcb:: with SMTP id w72-v6mr4627087pfj.129.1526552648613; Thu, 17 May 2018 03:24:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526552648; cv=none; d=google.com; s=arc-20160816; b=KBOqoIPfkoXkKPMqR+A+83uVMWLjW+B9qsjUCzvADMLVUtTeUcd+XKRLXZsrO8tAYL zrN9abErZWNPV6s1e9+sSaynRjSIlpPrtzVOdoztB0zBeApxaQjvjRNdGz1QelSC4sbr WJ6MDxEdpvoPs9aDaxt3e8hwq90/VS65BmYPJllkF7zi2vTsbY87gzIb/zAha46FaODQ VnCK4+sXCse/FylRjZqnakAhqmvEc0fcSNJETDkxqH4g/mIIJPYQ3NKQQX1UyRU6cogG SUqUbRqCuvYMIprhsY+GTZWxDV8wWvqu+DWv0FCx3rxnE59WHOnA5upv0nsBaWmYeMaW BwQQ== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=v2fVmFJY0tHYOJzRfcHIDnQbZ4kQAaYpFqEynERzWNc=; b=wW2glPE39S1a+y56eFe9IPFLKBR0779vkizuub31HkFo7Sr6mCA2UkkDIy4SjrKKpE FKKpbBpl7iDaYeJNDLSjg2f5eNTBXnCbJdy10+6PBSXYkiDGjDfdx0a7yhC54Fy7dmsR zHVZUEsVQl090Njbx1sPKe7hc8tQO02E9mf+ZmKzArQfxfGfSVGqQlvSO9HNxGTdTlec JmgIh7PBwNaPXXF5qqFE84N31chQPg3SdBkGG4f5jXYFC9JlxfsfAgKEbmoAEU7qzLSB 2PZfXziSeoLMEfvEh2FPuzj/fFVJpk/8AHPW/7S2JmGCDl21rHdjhUCsZyOlf8nv/mbI cOzQ== 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 p3-v6si5050186pfb.171.2018.05.17.03.23.54; Thu, 17 May 2018 03:24:08 -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 S1752014AbeEQKXi (ORCPT + 99 others); Thu, 17 May 2018 06:23:38 -0400 Received: from mx2.suse.de ([195.135.220.15]:48590 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751530AbeEQKXh (ORCPT ); Thu, 17 May 2018 06:23:37 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 77E61AEBF; Thu, 17 May 2018 10:23:35 +0000 (UTC) Date: Thu, 17 May 2018 12:23:30 +0200 From: Michal Hocko To: =?utf-8?B?56a56Iif6ZSu?= 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, Wind Yu Subject: Re: [PATCH] Add the memcg print oom info for system oom Message-ID: <20180517102330.GS12670@dhcp22.suse.cz> References: <1526540428-12178-1-git-send-email-ufo19890607@gmail.com> <20180517071140.GQ12670@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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 Thu 17-05-18 17:44:43, 禹舟键 wrote: > Hi Michal > I think the current OOM report is imcomplete. I can get the task which > invoked the oom-killer and the task which has been killed by the > oom-killer, and memory info when the oom happened. But I cannot infer the > certain memcg to which the task killed by oom-killer belongs, because that > task has been killed, and the dump_task will print all of the tasks in the > system. I can see how the origin memcg might be useful, but ... > > mem_cgroup_print_oom_info will print five lines of content including > memcg's name , usage, limit. I don't think five lines of content will cause > a big problem. Or it at least prints the memcg's name. this is not 5 lines at all. We dump memcg stats for the whole oom memcg subtree. For your patch it would be the whole subtree of the memcg of the oom victim. With cgroup v1 this can be quite deep as tasks can belong to inter-nodes as well. Would be pr_info("Task in "); pr_cont_cgroup_path(task_cgroup(p, memory_cgrp_id)); pr_cont(" killed as a result of limit of "); part of that output sufficient for your usecase? You will not get memory consumption of the group but is that really so relevant when we are killing individual tasks? Please note that there are proposals to make the global oom killer memcg aware and select by the memcg size rather than pick on random tasks (http://lkml.kernel.org/r/20171130152824.1591-1-guro@fb.com). Maybe that will be more interesting for your container usecase. -- Michal Hocko SUSE Labs