diff mbox series

[1/3] mm/memory_hotplug: use helper zone_is_zone_device() to simplify the code

Message ID 20210821094246.10149-2-linmiaohe@huawei.com (mailing list archive)
State New
Headers show
Series Cleanup and fixups for memory hotplug | expand

Commit Message

Miaohe Lin Aug. 21, 2021, 9:42 a.m. UTC
Use helper zone_is_zone_device() to simplify the code and remove some
explicit CONFIG_ZONE_DEVICE codes.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 mm/memory_hotplug.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

HORIGUCHI NAOYA(堀口 直也) Aug. 23, 2021, 8:20 a.m. UTC | #1
On Sat, Aug 21, 2021 at 05:42:44PM +0800, Miaohe Lin wrote:
> Use helper zone_is_zone_device() to simplify the code and remove some
> explicit CONFIG_ZONE_DEVICE codes.
> 
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>

Reviewed-by: Naoya Horiguchi <naoya.horiguchi@nec.com>
Oscar Salvador Aug. 23, 2021, 9:11 a.m. UTC | #2
On 2021-08-21 11:42, Miaohe Lin wrote:
> Use helper zone_is_zone_device() to simplify the code and remove some
> explicit CONFIG_ZONE_DEVICE codes.
> 
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>

Reviewed-by: Oscar Salvador <osalvador@suse.de>
David Hildenbrand Aug. 23, 2021, 12:14 p.m. UTC | #3
On 21.08.21 11:42, Miaohe Lin wrote:
> Use helper zone_is_zone_device() to simplify the code and remove some
> explicit CONFIG_ZONE_DEVICE codes.
> 
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> ---
>   mm/memory_hotplug.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index b287ff3d7229..d986d3791986 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -477,15 +477,13 @@ void __ref remove_pfn_range_from_zone(struct zone *zone,
>   				 sizeof(struct page) * cur_nr_pages);
>   	}
>   
> -#ifdef CONFIG_ZONE_DEVICE
>   	/*
>   	 * Zone shrinking code cannot properly deal with ZONE_DEVICE. So
>   	 * we will not try to shrink the zones - which is okay as
>   	 * set_zone_contiguous() cannot deal with ZONE_DEVICE either way.
>   	 */
> -	if (zone_idx(zone) == ZONE_DEVICE)
> +	if (zone_is_zone_device(zone))
>   		return;
> -#endif
>   
>   	clear_zone_contiguous(zone);
>   
> 

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

Patch

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index b287ff3d7229..d986d3791986 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -477,15 +477,13 @@  void __ref remove_pfn_range_from_zone(struct zone *zone,
 				 sizeof(struct page) * cur_nr_pages);
 	}
 
-#ifdef CONFIG_ZONE_DEVICE
 	/*
 	 * Zone shrinking code cannot properly deal with ZONE_DEVICE. So
 	 * we will not try to shrink the zones - which is okay as
 	 * set_zone_contiguous() cannot deal with ZONE_DEVICE either way.
 	 */
-	if (zone_idx(zone) == ZONE_DEVICE)
+	if (zone_is_zone_device(zone))
 		return;
-#endif
 
 	clear_zone_contiguous(zone);