From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.0 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E92CC433DF for ; Thu, 6 Aug 2020 13:35:21 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 29B8D2312D for ; Thu, 6 Aug 2020 13:35:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 29B8D2312D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 65AEF6B0003; Thu, 6 Aug 2020 09:35:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 60BDF6B0005; Thu, 6 Aug 2020 09:35:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 522A38D0001; Thu, 6 Aug 2020 09:35:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0246.hostedemail.com [216.40.44.246]) by kanga.kvack.org (Postfix) with ESMTP id 3E6476B0003 for ; Thu, 6 Aug 2020 09:35:20 -0400 (EDT) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id AE98982499B9 for ; Thu, 6 Aug 2020 13:35:19 +0000 (UTC) X-FDA: 77120240358.14.foot62_30074a026fb8 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin14.hostedemail.com (Postfix) with ESMTP id 8201418229818 for ; Thu, 6 Aug 2020 13:35:19 +0000 (UTC) X-HE-Tag: foot62_30074a026fb8 X-Filterd-Recvd-Size: 3438 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Thu, 6 Aug 2020 13:35:19 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 00621ABE4; Thu, 6 Aug 2020 13:35:34 +0000 (UTC) Subject: Re: [PATCH v2 4/6] mm/page_isolation: cleanup set_migratetype_isolate() To: David Hildenbrand , linux-kernel@vger.kernel.org Cc: virtualization@lists.linux-foundation.org, linux-mm@kvack.org, Baoquan He , Pankaj Gupta , Andrew Morton , Michal Hocko , "Michael S . Tsirkin" , Mike Kravetz References: <20200730093416.36210-1-david@redhat.com> <20200730093416.36210-5-david@redhat.com> From: Vlastimil Babka Message-ID: <74a25986-87cb-7ab6-e7a9-0c2aefcabe4a@suse.cz> Date: Thu, 6 Aug 2020 15:35:18 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200730093416.36210-5-david@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 8201418229818 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 7/30/20 11:34 AM, David Hildenbrand wrote: > Let's clean it up a bit, simplifying error handling and getting rid of > the label. Nit: the label was already removed by patch 1/6? > Reviewed-by: Baoquan He > Reviewed-by: Pankaj Gupta > Cc: Andrew Morton > Cc: Michal Hocko > Cc: Michael S. Tsirkin > Cc: Mike Kravetz > Signed-off-by: David Hildenbrand > --- > mm/page_isolation.c | 17 +++++++---------- > 1 file changed, 7 insertions(+), 10 deletions(-) > > diff --git a/mm/page_isolation.c b/mm/page_isolation.c > index d099aac479601..e65fe5d770849 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,13 +48,13 @@ 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; > } > > 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. > @@ -65,7 +62,7 @@ static int set_migratetype_isolate(struct page *page, int migratetype, int isol_ > dump_page(unmovable, "unmovable page"); > } > > - return ret; > + return -EBUSY; > } > > static void unset_migratetype_isolate(struct page *page, unsigned migratetype) >