linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: 禹舟键 <ufo19890607@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Michal Hocko <mhocko@suse.com>,
	David Rientjes <rientjes@google.com>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	aarcange@redhat.com,
	Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
	guro@fb.com, yang.s@alibaba-inc.com,
	linux-mm <linux-mm@kvack.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Wind Yu <yuzhoujian@didichuxing.com>
Subject: Re: [PATCH v11 1/2] Refactor part of the oom report in dump_header
Date: Wed, 4 Jul 2018 11:47:52 +0300	[thread overview]
Message-ID: <CAHp75Ve1JcxyVWUJagO8Jmj32sfBAjZcPKuG-xvYKMs0b_uCqA@mail.gmail.com> (raw)
In-Reply-To: <CAHCio2jv-xtnNbJ8beokueh-VQ6zZgF1hAFBJKHCNyuOuz2KxA@mail.gmail.com>

On Wed, Jul 4, 2018 at 5:25 AM, 禹舟键 <ufo19890607@gmail.com> 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 patch?
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,  <ufo19890607@gmail.com> wrote:
>> > From: yuzhoujian <yuzhoujian@didichuxing.com>
>> >
>> > 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. This
>> > information can be interesting for container users because they can find
>> > 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=<constraint>,nodemask=<nodemask>,oom_memcg=<memcg>,task_memcg=<memcg>,task=<comm>,pid=<pid>,uid=<uid>
>>
>>
>> > +static const char * const oom_constraint_text[] = {
>> > +       [CONSTRAINT_NONE] = "CONSTRAINT_NONE",
>> > +       [CONSTRAINT_CPUSET] = "CONSTRAINT_CPUSET",
>> > +       [CONSTRAINT_MEMORY_POLICY] = "CONSTRAINT_MEMORY_POLICY",
>> > +       [CONSTRAINT_MEMCG] = "CONSTRAINT_MEMCG",
>> > +};
>>
>> I'm not sure why we have this in the header.
>>
>> This produces a lot of noise when W=1.
>>
>> 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:
>> ‘oom_constraint_text’ defined but not used [-W
>> unused-const-variable=]
>> static const char * const oom_constraint_text[] = {
>>                           ^~~~~~~~~~~~~~~~~~~
>>  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



-- 
With Best Regards,
Andy Shevchenko

      parent reply	other threads:[~2018-07-04  8:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-30 16:38 [PATCH v11 1/2] Refactor part of the oom report in dump_header ufo19890607
2018-06-30 16:38 ` [PATCH v11 2/2] Add the missing information " ufo19890607
2018-07-02 10:22   ` Michal Hocko
2018-07-05  8:01   ` [lkp-robot] 3586e04c29: BUG:KASAN:user-memory-access_in_d kernel test robot
2018-07-02 10:17 ` [PATCH v11 1/2] Refactor part of the oom report in dump_header Michal Hocko
2018-07-03 10:57   ` 禹舟键
2018-07-03 11:03     ` Michal Hocko
2018-07-03 17:25 ` Andy Shevchenko
2018-07-04  2:25   ` 禹舟键
2018-07-04  8:17     ` Michal Hocko
2018-07-05 11:23       ` 禹舟键
2018-07-05 12:24         ` Andy Shevchenko
2018-07-04  8:47     ` Andy Shevchenko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHp75Ve1JcxyVWUJagO8Jmj32sfBAjZcPKuG-xvYKMs0b_uCqA@mail.gmail.com \
    --to=andy.shevchenko@gmail.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=guro@fb.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    --cc=rientjes@google.com \
    --cc=ufo19890607@gmail.com \
    --cc=yang.s@alibaba-inc.com \
    --cc=yuzhoujian@didichuxing.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).