* [PATCH] mm: use zonelist_zone() to get zone
@ 2024-07-06 1:50 Wei Yang
2024-07-07 8:12 ` David Hildenbrand
2024-07-08 9:30 ` Garg, Shivank
0 siblings, 2 replies; 4+ messages in thread
From: Wei Yang @ 2024-07-06 1:50 UTC (permalink / raw)
To: akpm; +Cc: linux-mm, Wei Yang, Mike Rapoport, David Hildenbrand
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;
}
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm: use zonelist_zone() to get zone
2024-07-06 1:50 [PATCH] mm: use zonelist_zone() to get zone Wei Yang
@ 2024-07-07 8:12 ` David Hildenbrand
2024-07-08 9:30 ` Garg, Shivank
1 sibling, 0 replies; 4+ messages in thread
From: David Hildenbrand @ 2024-07-07 8:12 UTC (permalink / raw)
To: Wei Yang, akpm; +Cc: linux-mm, Mike Rapoport
On 06.07.24 03:50, 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;
> }
>
>
Acked-by: David Hildenbrand <david@redhat.com>
--
Cheers,
David / dhildenb
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm: use zonelist_zone() to get zone
2024-07-06 1:50 [PATCH] mm: use zonelist_zone() to get zone Wei Yang
2024-07-07 8:12 ` David Hildenbrand
@ 2024-07-08 9:30 ` Garg, Shivank
2024-07-09 3:00 ` Wei Yang
1 sibling, 1 reply; 4+ messages in thread
From: Garg, Shivank @ 2024-07-08 9:30 UTC (permalink / raw)
To: Wei Yang, akpm; +Cc: linux-mm, Mike Rapoport, David Hildenbrand
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm: use zonelist_zone() to get zone
2024-07-08 9:30 ` Garg, Shivank
@ 2024-07-09 3:00 ` Wei Yang
0 siblings, 0 replies; 4+ messages in thread
From: Wei Yang @ 2024-07-09 3:00 UTC (permalink / raw)
To: Garg, Shivank; +Cc: Wei Yang, akpm, linux-mm, Mike Rapoport, David Hildenbrand
On Mon, Jul 08, 2024 at 03:00:50PM +0530, Garg, Shivank wrote:
>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.
>
Will add this, thanks.
>Thanks,
>Shivank
>
>
--
Wei Yang
Help you, Help me
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-07-09 3:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-06 1:50 [PATCH] mm: use zonelist_zone() to get zone Wei Yang
2024-07-07 8:12 ` David Hildenbrand
2024-07-08 9:30 ` Garg, Shivank
2024-07-09 3:00 ` Wei Yang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox