linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Pankaj Gupta <pankaj.gupta.linux@gmail.com>
To: Wei Yang <richard.weiyang@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org,  linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: rename gfpflags_to_migratetype to gfp_migratetype for same convention
Date: Mon, 30 Mar 2020 09:31:59 +0200	[thread overview]
Message-ID: <CAM9Jb+j3tC0ogmmy8HOkNmPEiTzJsDPpGXRVPP3_2YNkhf1BRg@mail.gmail.com> (raw)
In-Reply-To: <20200329080823.7735-1-richard.weiyang@gmail.com>

> Pageblock migrate type is encoded in GFP flags, just as zone_type and
> zonelist.
>
> Currently we use gfp_zone() and gfp_zonelist() to extract related
> information, it would be proper to use the same naming convention for
> migrate type.
>
> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
> ---
>  include/linux/gfp.h | 2 +-
>  mm/compaction.c     | 2 +-
>  mm/page_alloc.c     | 4 ++--
>  mm/page_owner.c     | 7 +++----
>  4 files changed, 7 insertions(+), 8 deletions(-)
>
> diff --git a/include/linux/gfp.h b/include/linux/gfp.h
> index e5b817cb86e7..7874b8e1c29f 100644
> --- a/include/linux/gfp.h
> +++ b/include/linux/gfp.h
> @@ -305,7 +305,7 @@ struct vm_area_struct;
>  #define GFP_MOVABLE_MASK (__GFP_RECLAIMABLE|__GFP_MOVABLE)
>  #define GFP_MOVABLE_SHIFT 3
>
> -static inline int gfpflags_to_migratetype(const gfp_t gfp_flags)
> +static inline int gfp_migratetype(const gfp_t gfp_flags)
>  {
>         VM_WARN_ON((gfp_flags & GFP_MOVABLE_MASK) == GFP_MOVABLE_MASK);
>         BUILD_BUG_ON((1UL << GFP_MOVABLE_SHIFT) != ___GFP_MOVABLE);
> diff --git a/mm/compaction.c b/mm/compaction.c
> index 672d3c78c6ab..784128c79e6f 100644
> --- a/mm/compaction.c
> +++ b/mm/compaction.c
> @@ -2089,7 +2089,7 @@ compact_zone(struct compact_control *cc, struct capture_control *capc)
>         INIT_LIST_HEAD(&cc->freepages);
>         INIT_LIST_HEAD(&cc->migratepages);
>
> -       cc->migratetype = gfpflags_to_migratetype(cc->gfp_mask);
> +       cc->migratetype = gfp_migratetype(cc->gfp_mask);
>         ret = compaction_suitable(cc->zone, cc->order, cc->alloc_flags,
>                                                         cc->classzone_idx);
>         /* Compaction is likely to fail */
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 0e823bca3f2f..ef790dfad6aa 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -4182,7 +4182,7 @@ gfp_to_alloc_flags(gfp_t gfp_mask)
>                 alloc_flags |= ALLOC_KSWAPD;
>
>  #ifdef CONFIG_CMA
> -       if (gfpflags_to_migratetype(gfp_mask) == MIGRATE_MOVABLE)
> +       if (gfp_migratetype(gfp_mask) == MIGRATE_MOVABLE)
>                 alloc_flags |= ALLOC_CMA;
>  #endif
>         return alloc_flags;
> @@ -4632,7 +4632,7 @@ static inline bool prepare_alloc_pages(gfp_t gfp_mask, unsigned int order,
>         ac->high_zoneidx = gfp_zone(gfp_mask);
>         ac->zonelist = node_zonelist(preferred_nid, gfp_mask);
>         ac->nodemask = nodemask;
> -       ac->migratetype = gfpflags_to_migratetype(gfp_mask);
> +       ac->migratetype = gfp_migratetype(gfp_mask);
>
>         if (cpusets_enabled()) {
>                 *alloc_mask |= __GFP_HARDWALL;
> diff --git a/mm/page_owner.c b/mm/page_owner.c
> index 18ecde9f45b2..360461509423 100644
> --- a/mm/page_owner.c
> +++ b/mm/page_owner.c
> @@ -312,8 +312,7 @@ void pagetypeinfo_showmixedcount_print(struct seq_file *m,
>                                 continue;
>
>                         page_owner = get_page_owner(page_ext);
> -                       page_mt = gfpflags_to_migratetype(
> -                                       page_owner->gfp_mask);
> +                       page_mt = gfp_migratetype(page_owner->gfp_mask);
>                         if (pageblock_mt != page_mt) {
>                                 if (is_migrate_cma(pageblock_mt))
>                                         count[MIGRATE_MOVABLE]++;
> @@ -359,7 +358,7 @@ print_page_owner(char __user *buf, size_t count, unsigned long pfn,
>
>         /* Print information relevant to grouping pages by mobility */
>         pageblock_mt = get_pageblock_migratetype(page);
> -       page_mt  = gfpflags_to_migratetype(page_owner->gfp_mask);
> +       page_mt  = gfp_migratetype(page_owner->gfp_mask);
>         ret += snprintf(kbuf + ret, count - ret,
>                         "PFN %lu type %s Block %lu type %s Flags %#lx(%pGp)\n",
>                         pfn,
> @@ -416,7 +415,7 @@ void __dump_page_owner(struct page *page)
>
>         page_owner = get_page_owner(page_ext);
>         gfp_mask = page_owner->gfp_mask;
> -       mt = gfpflags_to_migratetype(gfp_mask);
> +       mt = gfp_migratetype(gfp_mask);
>
>         if (!test_bit(PAGE_EXT_OWNER, &page_ext->flags)) {
>                 pr_alert("page_owner info is not present (never set?)\n");
> --
> 2.23.0

I think it makes sense for naming consistency, at-least to me.

Reviewed-by: Pankaj Gupta <pankaj.gupta.linux@gmail.com>
>
>


  reply	other threads:[~2020-03-30  7:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-29  8:08 Wei Yang
2020-03-30  7:31 ` Pankaj Gupta [this message]
2020-03-30 12:33   ` Wei Yang

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=CAM9Jb+j3tC0ogmmy8HOkNmPEiTzJsDPpGXRVPP3_2YNkhf1BRg@mail.gmail.com \
    --to=pankaj.gupta.linux@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=richard.weiyang@gmail.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