diff mbox series

[4/6] mm/page_alloc.c: use helper function zone_spans_pfn()

Message ID 20210830141051.64090-5-linmiaohe@huawei.com (mailing list archive)
State New
Headers show
Series Cleanups and fixup for page_alloc | expand

Commit Message

Miaohe Lin Aug. 30, 2021, 2:10 p.m. UTC
Use helper function zone_spans_pfn() to check whether pfn is within a
zone to simplify the code slightly.

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

Comments

Mel Gorman Aug. 31, 2021, 1:39 p.m. UTC | #1
On Mon, Aug 30, 2021 at 10:10:49PM +0800, Miaohe Lin wrote:
> Use helper function zone_spans_pfn() to check whether pfn is within a
> zone to simplify the code slightly.
> 
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>

Acked-by: Mel Gorman <mgorman@techsingularity.net>
David Hildenbrand Aug. 31, 2021, 2:08 p.m. UTC | #2
On 30.08.21 16:10, Miaohe Lin wrote:
> Use helper function zone_spans_pfn() to check whether pfn is within a
> zone to simplify the code slightly.
> 
> 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 b5edcfe112aa..7bb79e959ab4 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -1576,7 +1576,7 @@ static void __meminit init_reserved_page(unsigned long pfn)
>   	for (zid = 0; zid < MAX_NR_ZONES; zid++) {
>   		struct zone *zone = &pgdat->node_zones[zid];
>   
> -		if (pfn >= zone->zone_start_pfn && pfn < zone_end_pfn(zone))
> +		if (zone_spans_pfn(zone, pfn))
>   			break;
>   	}
>   	__init_single_page(pfn_to_page(pfn), pfn, zid, nid);
> 

Reviewed-by: David Hildenbrand <david@redhat.com>
diff mbox series

Patch

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index b5edcfe112aa..7bb79e959ab4 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1576,7 +1576,7 @@  static void __meminit init_reserved_page(unsigned long pfn)
 	for (zid = 0; zid < MAX_NR_ZONES; zid++) {
 		struct zone *zone = &pgdat->node_zones[zid];
 
-		if (pfn >= zone->zone_start_pfn && pfn < zone_end_pfn(zone))
+		if (zone_spans_pfn(zone, pfn))
 			break;
 	}
 	__init_single_page(pfn_to_page(pfn), pfn, zid, nid);