Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp557104imm; Wed, 4 Jul 2018 01:48:47 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcQ4DKz7yrEr9nYi/6CUmFSc78miLiieEhQlSUQxODCT9gBbT4YV85Jr+/VjDg9UrYEpq4N X-Received: by 2002:a17:902:8685:: with SMTP id g5-v6mr1227845plo.180.1530694127180; Wed, 04 Jul 2018 01:48:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530694127; cv=none; d=google.com; s=arc-20160816; b=EFULosXzAUVjAMNCV+FDgapLGvdtVDMI++AKSCPsMC9lHNa6IlawG2TQ7eMbloRoNs qgANJj4KkhQDdG+9WJV4ecb/Q1prb3+phz0NEvGF4B0VZd4cceBXClQajT3TCWoQPonp 8wTHI4FpXaFT1WxbI2kTgwDMISx5HLNVs3q6plxh9Q1EslXzf5W00zOnoJV/TZXO5tD3 6VsqnhSun4Irrw2wlMWe97N9z+NAq3Gt0CpRdBrNXDUr8FeEId9sGf8ZTwR+ZbyPyh/A ipbKb85RtGNJ1Zo3JgYyOzSo5pSrg3HpqIEX5MmEKKRz34CP7kSso+r/GmLQoEzpM9mj hTjA== 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:cc:to:subject :message-id:date:from:references:in-reply-to:mime-version :dkim-signature:arc-authentication-results; bh=+yrYri1rVJwBjq17HcmsNtutvo5/SBkrCbY1w9Hhk58=; b=DeBm0+nn1TKCWW2hswA+Al1QVl6z9Srx5sewjIA8Dg1m6y0gdEka4bVg0mBV+EhxnV INDOa5ERB5qANq7JqKCaqefDwMhKEzx8fHqT3T5E4HU89L4at2JHU4YqkRpTPzcE4HkF wVmv60ZHPdBqOfYx08sSesJJfvtQ9mm2atemYAPkwbYfYn5AlAJhtZTCU4mRjB/YAuO5 R7+DYxobDpNybm6rePhqTveBxUIY9Svr6VIXn6xBrnc4X+KxJHURngQfa7hMq4IknpZu 45pDSYnCVGVrUnyFiUVmb1nIIZ8U4JMRvFI7MD6XinEZPAdzJv55E2y2CpVI29t7AhE/ SsLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=mm+I4GIV; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r65-v6si3294936pfe.298.2018.07.04.01.48.33; Wed, 04 Jul 2018 01:48:47 -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=@gmail.com header.s=20161025 header.b=mm+I4GIV; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933862AbeGDIr5 (ORCPT + 99 others); Wed, 4 Jul 2018 04:47:57 -0400 Received: from mail-vk0-f65.google.com ([209.85.213.65]:46026 "EHLO mail-vk0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932439AbeGDIry (ORCPT ); Wed, 4 Jul 2018 04:47:54 -0400 Received: by mail-vk0-f65.google.com with SMTP id l64-v6so2663463vkl.12 for ; Wed, 04 Jul 2018 01:47:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=+yrYri1rVJwBjq17HcmsNtutvo5/SBkrCbY1w9Hhk58=; b=mm+I4GIV3aaWtnQgz7kXNmyNOtMFtHsXBGjctRg3sgWbBCDLqy5n8lmFWRKrCA9TDR hl+CuRyxsXriq+kmU5woJLVfZkYM9eaAu+YoYdT6zsOVmsbcLQ5SLlW8r8NJuS6gzVp/ r3goWgYHC70FGT8OcwxRR+Hru2/bkutLgt2jI13xEFvCBmg156KRY4xU+xwaPAmc8Hdn 4Q2ihXgvY+i0okPxg5DjSF3ZHf7ZAi8xy8VcNEce9v7dP0Xrytfe4VESoNMRVcwsLHSR UpOC8lOn7exvYaV8/mOltCZeLCHbR+sAK9WRzrQdXYgIEcwQ8P8STYzaOSeSMJxltAtP UJ7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=+yrYri1rVJwBjq17HcmsNtutvo5/SBkrCbY1w9Hhk58=; b=KCA8OFmDTAKH+GOmHHZf+YWj6Dq6D6G2rj/3IO+/nzO9gdY2rgrpNYSR4Yy1KvfZiH WlgoWJvmpsy7iRh/0n+q+YfF2E+bYNnLHchNlF3v961K73Ll0uJ0v990IufcZon9JOU4 pUOdUAeGih8a6nzxvASm/XLopJZeOsWBU4wohEGcLvi6QN64MCIuGpdSgVZWkUw88LPn vztrRBYE0yz7Z9roHT/VoF5ms4T1GpNnbc6uT1q+Ehtyo9KFcJNb5KD+sL1XNFU1477v FGRliRTBO68r9eGoS6NDA0QAYP/Pwe2zo+aqPU3Vk9ctS6tR4UpHcUMwMGni0ji0Rdgu 5dkw== X-Gm-Message-State: APt69E1lpHxRHdMIb57T3iyX+1iuL1pJYiITZRq8Cy6rkJ4794aJOEwz HoaQ1vcGJFtWxwjiT62Ao9rHKgC1ASEvip4Jn30= X-Received: by 2002:a1f:8e0f:: with SMTP id q15-v6mr583256vkd.161.1530694073615; Wed, 04 Jul 2018 01:47:53 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a67:2149:0:0:0:0:0 with HTTP; Wed, 4 Jul 2018 01:47:52 -0700 (PDT) In-Reply-To: References: <1530376739-20459-1-git-send-email-ufo19890607@gmail.com> From: Andy Shevchenko Date: Wed, 4 Jul 2018 11:47:52 +0300 Message-ID: Subject: Re: [PATCH v11 1/2] Refactor part of the oom report in dump_header To: =?UTF-8?B?56a56Iif6ZSu?= Cc: Andrew Morton , Michal Hocko , David Rientjes , "Kirill A. Shutemov" , aarcange@redhat.com, Tetsuo Handa , guro@fb.com, yang.s@alibaba-inc.com, linux-mm , Linux Kernel Mailing List , Wind Yu Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 4, 2018 at 5:25 AM, =E7=A6=B9=E8=88=9F=E9=94=AE wrote: > Hi Andy > The const char array need to be used by the new func > mem_cgroup_print_oom_context and some funcs in oom_kill.c in the > second patch. Did I understand correctly that the array is added by you in this solely pa= tch? Did I understand correctly that it's used only in one module (oom_kill.c in new version)? If both are true, just move it to the C file. If you need a synchronization, a) put a comment, b) create another enum item (like FOO_BAR_MAX) at the end and use it in the array as a fixed size, > > Thanks > >> >> On Sat, Jun 30, 2018 at 7:38 PM, wrote: >> > From: yuzhoujian >> > >> > The current system wide oom report prints information about the victim >> > and the allocation context and restrictions. It, however, doesn't >> > provide any information about memory cgroup the victim belongs to. Thi= s >> > information can be interesting for container users because they can fi= nd >> > the victim's container much more easily. >> > >> > I follow the advices of David Rientjes and Michal Hocko, and refactor >> > part of the oom report. After this patch, users can get the memcg's >> > path from the oom report and check the certain container more quickly. >> > >> > The oom print info after this patch: >> > oom-kill:constraint=3D,nodemask=3D,oom_memcg=3D<= memcg>,task_memcg=3D,task=3D,pid=3D,uid=3D >> >> >> > +static const char * const oom_constraint_text[] =3D { >> > + [CONSTRAINT_NONE] =3D "CONSTRAINT_NONE", >> > + [CONSTRAINT_CPUSET] =3D "CONSTRAINT_CPUSET", >> > + [CONSTRAINT_MEMORY_POLICY] =3D "CONSTRAINT_MEMORY_POLICY", >> > + [CONSTRAINT_MEMCG] =3D "CONSTRAINT_MEMCG", >> > +}; >> >> I'm not sure why we have this in the header. >> >> This produces a lot of noise when W=3D1. >> >> In file included from >> /home/andy/prj/linux-topic-mfld/include/linux/memcontrol.h:31:0, >> from /home/andy/prj/linux-topic-mfld/include/net/sock.h:= 58, >> from /home/andy/prj/linux-topic-mfld/include/linux/tcp.h= :23, >> from /home/andy/prj/linux-topic-mfld/include/linux/ipv6.= h:87, >> from /home/andy/prj/linux-topic-mfld/include/net/ipv6.h:= 16, >> from >> /home/andy/prj/linux-topic-mfld/net/ipv4/netfilter/nf_log_ipv4.c:17: >> /home/andy/prj/linux-topic-mfld/include/linux/oom.h:32:27: warning: >> =E2=80=98oom_constraint_text=E2=80=99 defined but not used [-W >> unused-const-variable=3D] >> static const char * const oom_constraint_text[] =3D { >> ^~~~~~~~~~~~~~~~~~~ >> CC [M] net/ipv4/netfilter/iptable_nat.o >> >> >> If you need (but looking at the code you actually don't if I didn't >> miss anything) it in several places, just export. >> Otherwise put it back to memcontrol.c. >> >> -- >> With Best Regards, >> Andy Shevchenko --=20 With Best Regards, Andy Shevchenko