[PATCH -mmotm] mm/memory_hotplug: fix for CONFIG_ZONE_DEVICE not enabled

From: Randy Dunlap
Date: Tue Jan 19 2021 - 22:06:31 EST


From: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>

Fix memory_hotplug.c when CONFIG_ZONE_DEVICE is not enabled.

Fixes this build error:

../mm/memory_hotplug.c: In function ‘move_pfn_range_to_zone’:
../mm/memory_hotplug.c:772:24: error: ‘ZONE_DEVICE’ undeclared (first use in this function); did you mean ‘ZONE_MOVABLE’?
if (zone_idx(zone) == ZONE_DEVICE) {

Signed-off-by: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: Dan Williams <dan.j.williams@xxxxxxxxx>
---
mm/memory_hotplug.c | 2 ++
1 file changed, 2 insertions(+)

--- mmotm-2021-0119-1336.orig/mm/memory_hotplug.c
+++ mmotm-2021-0119-1336/mm/memory_hotplug.c
@@ -769,12 +769,14 @@ void __ref move_pfn_range_to_zone(struct
* ZONE_DEVICE pages in an otherwise ZONE_{NORMAL,MOVABLE}
* section.
*/
+#ifdef CONFIG_ZONE_DEVICE
if (zone_idx(zone) == ZONE_DEVICE) {
if (!IS_ALIGNED(start_pfn, PAGES_PER_SECTION))
section_taint_zone_device(start_pfn);
if (!IS_ALIGNED(start_pfn + nr_pages, PAGES_PER_SECTION))
section_taint_zone_device(start_pfn + nr_pages);
}
+#endif

/*
* TODO now we have a visible range of pages which are not associated