From: "Garg, Shivank" <shivankg@amd.com>
To: Wei Yang <richard.weiyang@gmail.com>, akpm@linux-foundation.org
Cc: linux-mm@kvack.org, Mike Rapoport <rppt@kernel.org>,
David Hildenbrand <david@redhat.com>
Subject: Re: [PATCH] mm: use zonelist_zone() to get zone
Date: Mon, 8 Jul 2024 15:00:50 +0530 [thread overview]
Message-ID: <c6273c49-bb0c-4c4d-b9b5-087bf114c23a@amd.com> (raw)
In-Reply-To: <20240706015044.27789-1-richard.weiyang@gmail.com>
On 7/6/2024 7:20 AM, Wei Yang wrote:
> Instead of accessing zoneref->zone directly, use zonelist_zone() like
> other places for consistency.
>
> No functional change.
>
> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
> CC: Mike Rapoport (IBM) <rppt@kernel.org>
> CC: David Hildenbrand <david@redhat.com>
> ---
> include/linux/mmzone.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
> index cb7f265c2b96..51bce636373f 100644
> --- a/include/linux/mmzone.h
> +++ b/include/linux/mmzone.h
> @@ -1690,7 +1690,7 @@ static inline struct zoneref *first_zones_zonelist(struct zonelist *zonelist,
> zone = zonelist_zone(z))
>
> #define for_next_zone_zonelist_nodemask(zone, z, highidx, nodemask) \
> - for (zone = z->zone; \
> + for (zone = zonelist_zone(z); \
> zone; \
> z = next_zones_zonelist(++z, highidx, nodemask), \
> zone = zonelist_zone(z))
> @@ -1726,7 +1726,7 @@ static inline bool movable_only_nodes(nodemask_t *nodes)
> nid = first_node(*nodes);
> zonelist = &NODE_DATA(nid)->node_zonelists[ZONELIST_FALLBACK];
> z = first_zones_zonelist(zonelist, ZONE_NORMAL, nodes);
> - return (!z->zone) ? true : false;
> + return (!zonelist_zone(z)) ? true : false;
> }
>
>
Hi Wei,
I'd like to propose extending the use of the zonelist_zone helper
function in several other locations.
I've identified the following places where zonelist_zone could be
used instead of the current approach:
oom.h:58 __entry->node = zone_to_nid(zoneref->zone);
mempolicy.c:1956 return z->zone ? zone_to_nid(z->zone) : node;
mempolicy.c:2805 polnid = zone_to_nid(z->zone);
page_alloc.c:4205 if (!z->zone)
page_alloc.c:5285 return zone_to_nid(z->zone);
I hope this will further help with improving readability and
maintainability across mm.
Thanks,
Shivank
next prev parent reply other threads:[~2024-07-08 9:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-06 1:50 Wei Yang
2024-07-07 8:12 ` David Hildenbrand
2024-07-08 9:30 ` Garg, Shivank [this message]
2024-07-09 3:00 ` 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=c6273c49-bb0c-4c4d-b9b5-087bf114c23a@amd.com \
--to=shivankg@amd.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=linux-mm@kvack.org \
--cc=richard.weiyang@gmail.com \
--cc=rppt@kernel.org \
/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