Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2621356imm; Sun, 3 Jun 2018 07:46:08 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIWfhf6OpLivTQuguUNCRePzgt3KH6/tTCbh/u1zIrHnfgNt1ssbqm10FbtxIQx/ZZozLp7 X-Received: by 2002:a17:902:b692:: with SMTP id c18-v6mr18101975pls.307.1528037168418; Sun, 03 Jun 2018 07:46:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528037168; cv=none; d=google.com; s=arc-20160816; b=W0eSrNKfR1ZoOYlqY463pGR9UcJk/AY40H1aQ8npWuTzodf3oOenYEbT+/wrTvL0Rs nkcWMPwfgaQo9Zm/LEuW+S1TYAmuRqGtnx47xf2TrOR+w1v5CYd3NKbrJTmqQLE4Ec+n 0CEVVSanDPa6GgDv0m06vgvCkZjV8jaZIpIDHDLYdXbHxXCPYlNST4YJb+UQfD4nxngf Uol19GFTs86vZYNsvo0RugXEJ8W6985YnVbmOX2+yxv2642lg4aC/39HGY+2yByAYdgL MpY2Dc5vnjmWPHk4GcHOAampf4yPRUeqeJhdWQN/MJmFn/T0atZRuXfKilVCA/Pzz+nN j9ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=YuciykmC5bGL1SwpLa/s9POiC0IXa5hDkwHK3gWQX+4=; b=wus7YXiSoYhRHEN8oB5y9q45ig567MhEx8dJ7eYXY63Xci+ALlvelGodpf4F5LBoBH 6kzrPqnAwjAyHqD+1CtEfH7wGp8qDJMrVmYi2bofh4glH5c0NuMt8w+S9tSThfBFbo0L 73vsugYziB+sHP8csAsEXOitA++y3nGIpKzmd9wkQ51yQSX5+qNGXQJcool+S82qKTRU C5hRiFJoD8W4EN91b/Z7y1cTcTtLVFM1vHvTYTfgkDlZHxduqr9qLljQ/3dB+fGdKZ8g H5NKp6HYKbHpeZv3pRA75xiSaodhKkJiecplRr4wVb2RDA2XTxlgrSS5o0DFr3LiTP8J 0xzw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w189-v6si21849115pgb.431.2018.06.03.07.45.54; Sun, 03 Jun 2018 07:46: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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751467AbeFCOp2 (ORCPT + 99 others); Sun, 3 Jun 2018 10:45:28 -0400 Received: from www262.sakura.ne.jp ([202.181.97.72]:52953 "EHLO www262.sakura.ne.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751243AbeFCOp1 (ORCPT ); Sun, 3 Jun 2018 10:45:27 -0400 Received: from fsav305.sakura.ne.jp (fsav305.sakura.ne.jp [153.120.85.136]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id w53EjPmH062081; Sun, 3 Jun 2018 23:45:25 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav305.sakura.ne.jp (F-Secure/fsigk_smtp/530/fsav305.sakura.ne.jp); Sun, 03 Jun 2018 23:45:25 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/530/fsav305.sakura.ne.jp) Received: from [192.168.1.8] (softbank126074194044.bbtec.net [126.74.194.44]) (authenticated bits=0) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id w53EjHjP061940 (version=TLSv1.2 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 3 Jun 2018 23:45:24 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Subject: Re: [PATCH v7 2/2] Refactor part of the oom report in dump_header To: ufo19890607@gmail.com Cc: akpm@linux-foundation.org, mhocko@suse.com, rientjes@google.com, kirill.shutemov@linux.intel.com, aarcange@redhat.com, guro@fb.com, yang.s@alibaba-inc.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, yuzhoujian References: <1527940734-35161-1-git-send-email-ufo19890607@gmail.com> <1527940734-35161-2-git-send-email-ufo19890607@gmail.com> From: Tetsuo Handa Message-ID: Date: Sun, 3 Jun 2018 23:45:15 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <1527940734-35161-2-git-send-email-ufo19890607@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/06/02 20:58, yuzhoujian wrote: > -void mem_cgroup_print_oom_info(struct mem_cgroup *memcg, struct task_struct *p) > +void mem_cgroup_print_oom_context(struct mem_cgroup *memcg, struct task_struct *p, > + enum oom_constraint constraint, nodemask_t *nodemask) > { > - struct mem_cgroup *iter; > - unsigned int i; > + static char origin_memcg_name[NAME_MAX], kill_memcg_name[NAME_MAX]; > + struct cgroup *origin_cgrp, *kill_cgrp; > > rcu_read_lock(); > - > - if (p) { > - pr_info("Task in "); > - pr_cont_cgroup_path(task_cgroup(p, memory_cgrp_id)); > - pr_cont(" killed as a result of limit of "); > - } else { > - pr_info("Memory limit reached of cgroup "); > + if (memcg) { > + origin_cgrp = memcg->css.cgroup; > + cgroup_path(origin_cgrp, origin_memcg_name, NAME_MAX); > } > - > - pr_cont_cgroup_path(memcg->css.cgroup); > - pr_cont("\n"); > - > + kill_cgrp = task_cgroup(p, memory_cgrp_id); > + cgroup_path(kill_cgrp, kill_memcg_name, NAME_MAX); > + > + if (p) > + pr_info("oom-kill:constraint=%s,nodemask=%*pbl,origin_memcg=%s,kill_memcg=%s,task=%s,pid=%5d,uid=%5d\n", > + oom_constraint_text[constraint], nodemask_pr_args(nodemask), > + strlen(origin_memcg_name) ? origin_memcg_name : "(null)", Since origin_memcg_name is printed for both memcg OOM and !memcg OOM, it is strange that origin_memcg_name is updated only when memcg != NULL. Have you really tested !memcg OOM case?