linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Weizhao Ouyang <o451686892@gmail.com>
To: John Hubbard <jhubbard@nvidia.com>, "Huang, Ying" <ying.huang@intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Pavel Tatashin <pasha.tatashin@soleen.com>,
	Oscar Salvador <osalvador@suse.de>,
	Yang Shi <shy828301@gmail.com>, Zi Yan <ziy@nvidia.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/debug: sync up latest migrate_reason to migrate_reason_names
Date: Sat, 18 Sep 2021 15:03:32 +0800	[thread overview]
Message-ID: <b4123610-bddf-03b9-2190-7b0cda55b57c@gmail.com> (raw)
In-Reply-To: <3cf9bb7f-618e-4e4b-32d6-4d3c207b9a9a@nvidia.com>


On 2021/9/18 08:30, John Hubbard wrote:
> On 9/17/21 02:48, Weizhao Ouyang wrote:
> ...
>>>>   const struct trace_print_flags pageflag_names[] = {
>>> Good catch!  Thanks!
>>>
>>> Reviewed-by: "Huang, Ying" <ying.huang@intel.com>
>>>
>>> It may be better to use BUILD_BUG_ON() to capture similar issue earlier?
>>
>> How about move migrate_reason_names into mm/page_owner.c and make it size uninitialized(get rid of MR_TYPES).
>> Then use BUILD_BUG_ON(ARRAY_SIZE(migrate_reason_names != MR_TYPES)) to check it?
>>
> A couple more thoughts:
>
> 1) From a naming and location point of view, migrate_reason_names[]
> really doesn't want to be located in page_owner.c.

Commit 7cd12b4abfd2 ("mm, page_owner: track and print last migrate reason")
imported migrate_reason_names for page owner in mm/debug.c, and it only used
by page_owner.c now, maybe it's not so sensitive or we can rename it.

> 2) There are actually three places to synchronize, not two. And in fact,
> sure enough, the MR_CONTIG_RANGE is already drifting out of synch: it
> has a string of "cma" in mm/debug.c, versus "contig_range" in
> include/trace/events/migrate.h.

Yes, "cma" is out of synch after commit 310253514bbf ("mm/migrate: rename
migration reason MR_CMA to MR_CONTIG_RANGE"). Update it to "contig_range" in
migrate_reason_names can fix up it.

> So...is it possible to use the macro and enums in
> include/trace/events/migrate.h, to define the connection between
> migrate_reason and a string, everywhere?

As for synchronization, tracepoint use TRACE_DEFINE_ENUM() macro to map enums.
In general, this kind of synch between subsystem and trace event subsystem is
mostly conscious. So it more likes that include/linux/migrate.h is connected to
include/trace/events/migrate.h and migrate_reason_names, the others hasn't
relationship except same reason string.
 
Anyway, I didn't find a simply way the build the "everywhere" relationship behind
the packaged TRACE_DEFINE_ENUM , what do you think.

Thanks,
Weizhao




  reply	other threads:[~2021-09-18  7:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-17  6:14 Weizhao Ouyang
2021-09-17  7:03 ` Huang, Ying
2021-09-17  7:27   ` John Hubbard
2021-09-17  9:48   ` Weizhao Ouyang
2021-09-18  0:30     ` John Hubbard
2021-09-18  7:03       ` Weizhao Ouyang [this message]
2021-09-19  5:38         ` John Hubbard
2021-09-20  9:14           ` Weizhao Ouyang
2021-09-19 23:35 ` Andrew Morton
2021-09-20  9:16   ` Weizhao Ouyang

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=b4123610-bddf-03b9-2190-7b0cda55b57c@gmail.com \
    --to=o451686892@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=dave.hansen@linux.intel.com \
    --cc=jhubbard@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=osalvador@suse.de \
    --cc=pasha.tatashin@soleen.com \
    --cc=shy828301@gmail.com \
    --cc=ying.huang@intel.com \
    --cc=ziy@nvidia.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