diff mbox series

[09/16] mm/page_alloc: use local variable zone_idx directly

Message ID 20220909092451.24883-10-linmiaohe@huawei.com (mailing list archive)
State New
Headers show
Series A few cleanup patches for mm | expand

Commit Message

Miaohe Lin Sept. 9, 2022, 9:24 a.m. UTC
Use local variable zone_idx directly since it holds the exact value of
zone_idx(). No functional change intended.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 mm/page_alloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Hildenbrand Sept. 9, 2022, 11:31 a.m. UTC | #1
On 09.09.22 11:24, Miaohe Lin wrote:
> Use local variable zone_idx directly since it holds the exact value of
> zone_idx(). No functional change intended.
> 
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> ---
>   mm/page_alloc.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 94baf33da865..3417232afa45 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -6878,7 +6878,7 @@ void __ref memmap_init_zone_device(struct zone *zone,
>   	unsigned long start = jiffies;
>   	int nid = pgdat->node_id;
>   
> -	if (WARN_ON_ONCE(!pgmap || zone_idx(zone) != ZONE_DEVICE))
> +	if (WARN_ON_ONCE(!pgmap || zone_idx != ZONE_DEVICE))
>   		return;
>   
>   	/*

Reviewed-by: David Hildenbrand <david@redhat.com>
Anshuman Khandual Sept. 13, 2022, 8:49 a.m. UTC | #2
On 9/9/22 14:54, Miaohe Lin wrote:
> Use local variable zone_idx directly since it holds the exact value of
> zone_idx(). No functional change intended.
> 
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>

Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>

> ---
>  mm/page_alloc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 94baf33da865..3417232afa45 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -6878,7 +6878,7 @@ void __ref memmap_init_zone_device(struct zone *zone,
>  	unsigned long start = jiffies;
>  	int nid = pgdat->node_id;
>  
> -	if (WARN_ON_ONCE(!pgmap || zone_idx(zone) != ZONE_DEVICE))
> +	if (WARN_ON_ONCE(!pgmap || zone_idx != ZONE_DEVICE))
>  		return;
>  
>  	/*
Oscar Salvador Sept. 15, 2022, 7:36 a.m. UTC | #3
On Fri, Sep 09, 2022 at 05:24:44PM +0800, Miaohe Lin wrote:
> Use local variable zone_idx directly since it holds the exact value of
> zone_idx(). No functional change intended.
> 
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>

By the way, zone_idx being "int" should be enough?

Reviewed-by: Oscar Salvador <osalvador@suse.de>

> ---
>  mm/page_alloc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 94baf33da865..3417232afa45 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -6878,7 +6878,7 @@ void __ref memmap_init_zone_device(struct zone *zone,
>  	unsigned long start = jiffies;
>  	int nid = pgdat->node_id;
>  
> -	if (WARN_ON_ONCE(!pgmap || zone_idx(zone) != ZONE_DEVICE))
> +	if (WARN_ON_ONCE(!pgmap || zone_idx != ZONE_DEVICE))
>  		return;
>  
>  	/*
> -- 
> 2.23.0
>
Miaohe Lin Sept. 15, 2022, 8:06 a.m. UTC | #4
On 2022/9/15 15:36, Oscar Salvador wrote:
> On Fri, Sep 09, 2022 at 05:24:44PM +0800, Miaohe Lin wrote:
>> Use local variable zone_idx directly since it holds the exact value of
>> zone_idx(). No functional change intended.
>>
>> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> 
> By the way, zone_idx being "int" should be enough?

Yes, it should be. But zone_idx is used as "unsigned long" around this function,
e.g. __init_zone_device_page expects zone_idx as "unsigned long", so it should be
better to keep it as is ?

> 
> Reviewed-by: Oscar Salvador <osalvador@suse.de>

Many thanks for your review and comment in this series.

Thanks,
Miaohe Lin


> 
>> ---
>>  mm/page_alloc.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>> index 94baf33da865..3417232afa45 100644
>> --- a/mm/page_alloc.c
>> +++ b/mm/page_alloc.c
>> @@ -6878,7 +6878,7 @@ void __ref memmap_init_zone_device(struct zone *zone,
>>  	unsigned long start = jiffies;
>>  	int nid = pgdat->node_id;
>>  
>> -	if (WARN_ON_ONCE(!pgmap || zone_idx(zone) != ZONE_DEVICE))
>> +	if (WARN_ON_ONCE(!pgmap || zone_idx != ZONE_DEVICE))
>>  		return;
>>  
>>  	/*
>> -- 
>> 2.23.0
>>
>
diff mbox series

Patch

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 94baf33da865..3417232afa45 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -6878,7 +6878,7 @@  void __ref memmap_init_zone_device(struct zone *zone,
 	unsigned long start = jiffies;
 	int nid = pgdat->node_id;
 
-	if (WARN_ON_ONCE(!pgmap || zone_idx(zone) != ZONE_DEVICE))
+	if (WARN_ON_ONCE(!pgmap || zone_idx != ZONE_DEVICE))
 		return;
 
 	/*