[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAM9Jb+iBVeFDyichYkdZgcHgd6wJABygJ_GwuL_Og_bqjQ=KwQ@mail.gmail.com>
Date: Thu, 30 Jul 2020 06:31:00 +0200
From: Pankaj Gupta <pankaj.gupta.linux@...il.com>
To: David Hildenbrand <david@...hat.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
virtualization@...ts.linux-foundation.org,
Linux MM <linux-mm@...ck.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Michal Hocko <mhocko@...e.com>,
"Michael S . Tsirkin" <mst@...hat.com>
Subject: Re: [PATCH v1 4/6] mm/page_isolation: cleanup set_migratetype_isolate()
> Let's clean it up a bit, simplifying error handling and getting rid of
> the label.
>
> Cc: Andrew Morton <akpm@...ux-foundation.org>
> Cc: Michal Hocko <mhocko@...e.com>
> Cc: Michael S. Tsirkin <mst@...hat.com>
> Signed-off-by: David Hildenbrand <david@...hat.com>
> ---
> mm/page_isolation.c | 18 +++++++-----------
> 1 file changed, 7 insertions(+), 11 deletions(-)
>
> diff --git a/mm/page_isolation.c b/mm/page_isolation.c
> index 02a01bff6b219..5f869bef23fa4 100644
> --- a/mm/page_isolation.c
> +++ b/mm/page_isolation.c
> @@ -17,12 +17,9 @@
>
> static int set_migratetype_isolate(struct page *page, int migratetype, int isol_flags)
> {
> - struct page *unmovable = NULL;
> - struct zone *zone;
> + struct zone *zone = page_zone(page);
> + struct page *unmovable;
> unsigned long flags;
> - int ret = -EBUSY;
> -
> - zone = page_zone(page);
>
> spin_lock_irqsave(&zone->lock, flags);
>
> @@ -51,21 +48,20 @@ static int set_migratetype_isolate(struct page *page, int migratetype, int isol_
> NULL);
>
> __mod_zone_freepage_state(zone, -nr_pages, mt);
> - ret = 0;
> + spin_unlock_irqrestore(&zone->lock, flags);
> + drain_all_pages(zone);
> + return 0;
> }
>
> -out:
> spin_unlock_irqrestore(&zone->lock, flags);
> - if (!ret) {
> - drain_all_pages(zone);
> - } else if ((isol_flags & REPORT_FAILURE) && unmovable)
> + if (isol_flags & REPORT_FAILURE)
> /*
> * printk() with zone->lock held will likely trigger a
> * lockdep splat, so defer it here.
> */
> dump_page(unmovable, "unmovable page");
>
> - return ret;
> + return -EBUSY;
> }
>
> static void unset_migratetype_isolate(struct page *page, unsigned migratetype)
> --
This clean up looks good to me.
Reviewed-by: Pankaj Gupta <pankaj.gupta.linux@...il.com>
> 2.26.2
>
>
Powered by blists - more mailing lists