Re: [PATCH v1 07/11] mm/page_isolation: simplify return value of start_isolate_page_range()

From: Michal Hocko
Date: Wed Aug 19 2020 - 09:06:49 EST


On Wed 19-08-20 12:11:53, David Hildenbrand wrote:
> Callers no longer need the number of isolated pageblocks. Let's
> simplify.
>
> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> Cc: Michal Hocko <mhocko@xxxxxxxx>
> Cc: Wei Yang <richard.weiyang@xxxxxxxxxxxxxxxxx>
> Cc: Baoquan He <bhe@xxxxxxxxxx>
> Cc: Pankaj Gupta <pankaj.gupta.linux@xxxxxxxxx>
> Cc: Oscar Salvador <osalvador@xxxxxxx>
> Signed-off-by: David Hildenbrand <david@xxxxxxxxxx>

Acked-by: Michal Hocko <mhocko@xxxxxxxx>

> ---
> mm/memory_hotplug.c | 2 +-
> mm/page_alloc.c | 2 +-
> mm/page_isolation.c | 7 ++-----
> 3 files changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 098361fcb4504..0011a1115381c 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -1503,7 +1503,7 @@ int __ref offline_pages(unsigned long start_pfn, unsigned long nr_pages)
> ret = start_isolate_page_range(start_pfn, end_pfn,
> MIGRATE_MOVABLE,
> MEMORY_OFFLINE | REPORT_FAILURE);
> - if (ret < 0) {
> + if (ret) {
> reason = "failure to isolate range";
> goto failed_removal;
> }
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 03f585f95dc60..848664352dfe2 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -8456,7 +8456,7 @@ int alloc_contig_range(unsigned long start, unsigned long end,
>
> ret = start_isolate_page_range(pfn_max_align_down(start),
> pfn_max_align_up(end), migratetype, 0);
> - if (ret < 0)
> + if (ret)
> return ret;
>
> /*
> diff --git a/mm/page_isolation.c b/mm/page_isolation.c
> index 242c03121d731..b066c860e606e 100644
> --- a/mm/page_isolation.c
> +++ b/mm/page_isolation.c
> @@ -170,8 +170,7 @@ __first_valid_page(unsigned long pfn, unsigned long nr_pages)
> * pageblocks we may have modified and return -EBUSY to caller. This
> * prevents two threads from simultaneously working on overlapping ranges.
> *
> - * Return: the number of isolated pageblocks on success and -EBUSY if any part
> - * of range cannot be isolated.
> + * Return: 0 on success and -EBUSY if any part of range cannot be isolated.
> */
> int start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn,
> unsigned migratetype, int flags)
> @@ -179,7 +178,6 @@ int start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn,
> unsigned long pfn;
> unsigned long undo_pfn;
> struct page *page;
> - int nr_isolate_pageblock = 0;
>
> BUG_ON(!IS_ALIGNED(start_pfn, pageblock_nr_pages));
> BUG_ON(!IS_ALIGNED(end_pfn, pageblock_nr_pages));
> @@ -193,10 +191,9 @@ int start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn,
> undo_pfn = pfn;
> goto undo;
> }
> - nr_isolate_pageblock++;
> }
> }
> - return nr_isolate_pageblock;
> + return 0;
> undo:
> for (pfn = start_pfn;
> pfn < undo_pfn;
> --
> 2.26.2

--
Michal Hocko
SUSE Labs