* [PATCH] mm: Fix ZONE_DEVICE usage in move_pfn_range_to_zone()
@ 2021-01-20 4:16 Dan Williams
2021-01-20 11:49 ` David Hildenbrand
2021-01-21 2:50 ` Miaohe Lin
0 siblings, 2 replies; 3+ messages in thread
From: Dan Williams @ 2021-01-20 4:16 UTC (permalink / raw)
To: akpm; +Cc: Randy Dunlap, linux-mm, linux-kernel
Randy reports the build breaks with recent additions of
section_taint_zone_device() in move_pfn_range_to_zone(). Fix that by
including a conditionally stubbed out zone_is_zone_device() helper.
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
Andrew, apologies for the thrash. Please fold this into:
mm-teach-pfn_to_online_page-about-zone_device-section-collisions.patch
include/linux/mmzone.h | 12 ++++++++++++
mm/memory_hotplug.c | 2 +-
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 0b5c44f730b4..66ba38dae9ba 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -885,6 +885,18 @@ static inline int local_memory_node(int node_id) { return node_id; };
*/
#define zone_idx(zone) ((zone) - (zone)->zone_pgdat->node_zones)
+#ifdef CONFIG_ZONE_DEVICE
+static inline bool zone_is_zone_device(struct zone *zone)
+{
+ return zone_idx(zone) == ZONE_DEVICE;
+}
+#else
+static inline bool zone_is_zone_device(struct zone *zone)
+{
+ return false;
+}
+#endif
+
/*
* Returns true if a zone has pages managed by the buddy allocator.
* All the reclaim decisions have to use this function rather than
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index c78a1bef561b..710e469fb3a1 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -769,7 +769,7 @@ void __ref move_pfn_range_to_zone(struct zone *zone, unsigned long start_pfn,
* ZONE_DEVICE pages in an otherwise ZONE_{NORMAL,MOVABLE}
* section.
*/
- if (zone_idx(zone) == ZONE_DEVICE) {
+ if (zone_is_zone_device(zone)) {
if (!IS_ALIGNED(start_pfn, PAGES_PER_SECTION))
section_taint_zone_device(start_pfn);
if (!IS_ALIGNED(start_pfn + nr_pages, PAGES_PER_SECTION))
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mm: Fix ZONE_DEVICE usage in move_pfn_range_to_zone()
2021-01-20 4:16 [PATCH] mm: Fix ZONE_DEVICE usage in move_pfn_range_to_zone() Dan Williams
@ 2021-01-20 11:49 ` David Hildenbrand
2021-01-21 2:50 ` Miaohe Lin
1 sibling, 0 replies; 3+ messages in thread
From: David Hildenbrand @ 2021-01-20 11:49 UTC (permalink / raw)
To: Dan Williams, akpm; +Cc: Randy Dunlap, linux-mm, linux-kernel
On 20.01.21 05:16, Dan Williams wrote:
> Randy reports the build breaks with recent additions of
> section_taint_zone_device() in move_pfn_range_to_zone(). Fix that by
> including a conditionally stubbed out zone_is_zone_device() helper.
>
> Reported-by: Randy Dunlap <rdunlap@infradead.org>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
> Andrew, apologies for the thrash. Please fold this into:
>
> mm-teach-pfn_to_online_page-about-zone_device-section-collisions.patch
>
> include/linux/mmzone.h | 12 ++++++++++++
> mm/memory_hotplug.c | 2 +-
> 2 files changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
> index 0b5c44f730b4..66ba38dae9ba 100644
> --- a/include/linux/mmzone.h
> +++ b/include/linux/mmzone.h
> @@ -885,6 +885,18 @@ static inline int local_memory_node(int node_id) { return node_id; };
> */
> #define zone_idx(zone) ((zone) - (zone)->zone_pgdat->node_zones)
>
> +#ifdef CONFIG_ZONE_DEVICE
> +static inline bool zone_is_zone_device(struct zone *zone)
> +{
> + return zone_idx(zone) == ZONE_DEVICE;
> +}
> +#else
> +static inline bool zone_is_zone_device(struct zone *zone)
> +{
> + return false;
> +}
> +#endif
> +
> /*
> * Returns true if a zone has pages managed by the buddy allocator.
> * All the reclaim decisions have to use this function rather than
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index c78a1bef561b..710e469fb3a1 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -769,7 +769,7 @@ void __ref move_pfn_range_to_zone(struct zone *zone, unsigned long start_pfn,
> * ZONE_DEVICE pages in an otherwise ZONE_{NORMAL,MOVABLE}
> * section.
> */
> - if (zone_idx(zone) == ZONE_DEVICE) {
> + if (zone_is_zone_device(zone)) {
> if (!IS_ALIGNED(start_pfn, PAGES_PER_SECTION))
> section_taint_zone_device(start_pfn);
> if (!IS_ALIGNED(start_pfn + nr_pages, PAGES_PER_SECTION))
>
>
Reviewed-by: David Hildenbrand <david@redhat.com>
--
Thanks,
David / dhildenb
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mm: Fix ZONE_DEVICE usage in move_pfn_range_to_zone()
2021-01-20 4:16 [PATCH] mm: Fix ZONE_DEVICE usage in move_pfn_range_to_zone() Dan Williams
2021-01-20 11:49 ` David Hildenbrand
@ 2021-01-21 2:50 ` Miaohe Lin
1 sibling, 0 replies; 3+ messages in thread
From: Miaohe Lin @ 2021-01-21 2:50 UTC (permalink / raw)
To: Dan Williams; +Cc: Randy Dunlap, linux-mm, linux-kernel, Andrew Morton
On 2021/1/20 12:16, Dan Williams wrote:
> Randy reports the build breaks with recent additions of
> section_taint_zone_device() in move_pfn_range_to_zone(). Fix that by
> including a conditionally stubbed out zone_is_zone_device() helper.
>
> Reported-by: Randy Dunlap <rdunlap@infradead.org>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
> Andrew, apologies for the thrash. Please fold this into:
>
> mm-teach-pfn_to_online_page-about-zone_device-section-collisions.patch
>
> include/linux/mmzone.h | 12 ++++++++++++
> mm/memory_hotplug.c | 2 +-
> 2 files changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
> index 0b5c44f730b4..66ba38dae9ba 100644
> --- a/include/linux/mmzone.h
> +++ b/include/linux/mmzone.h
> @@ -885,6 +885,18 @@ static inline int local_memory_node(int node_id) { return node_id; };
> */
> #define zone_idx(zone) ((zone) - (zone)->zone_pgdat->node_zones)
>
> +#ifdef CONFIG_ZONE_DEVICE
> +static inline bool zone_is_zone_device(struct zone *zone)
> +{
> + return zone_idx(zone) == ZONE_DEVICE;
> +}
> +#else
> +static inline bool zone_is_zone_device(struct zone *zone)
> +{
> + return false;
> +}
> +#endif
> +
> /*
> * Returns true if a zone has pages managed by the buddy allocator.
> * All the reclaim decisions have to use this function rather than
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index c78a1bef561b..710e469fb3a1 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -769,7 +769,7 @@ void __ref move_pfn_range_to_zone(struct zone *zone, unsigned long start_pfn,
> * ZONE_DEVICE pages in an otherwise ZONE_{NORMAL,MOVABLE}
> * section.
> */
> - if (zone_idx(zone) == ZONE_DEVICE) {
> + if (zone_is_zone_device(zone)) {
> if (!IS_ALIGNED(start_pfn, PAGES_PER_SECTION))
> section_taint_zone_device(start_pfn);
> if (!IS_ALIGNED(start_pfn + nr_pages, PAGES_PER_SECTION))
>
>
> .
>
Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-01-21 2:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-20 4:16 [PATCH] mm: Fix ZONE_DEVICE usage in move_pfn_range_to_zone() Dan Williams
2021-01-20 11:49 ` David Hildenbrand
2021-01-21 2:50 ` Miaohe Lin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox