Message ID | 20230215230300.61125-2-sj@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp467077wrn; Wed, 15 Feb 2023 15:06:25 -0800 (PST) X-Google-Smtp-Source: AK7set+mBPk28xCskR1Z0t9mgssuDvhsvgDO0Ob7QjUhwyPt9+Vm+yux5TpJ/RNiltmO/QbnXo1t X-Received: by 2002:aa7:d998:0:b0:4ac:c80c:9a11 with SMTP id u24-20020aa7d998000000b004acc80c9a11mr3576799eds.10.1676502384824; Wed, 15 Feb 2023 15:06:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676502384; cv=none; d=google.com; s=arc-20160816; b=vBxYwi0FF7KpEc0RDr0tbmECI0Upc/py8b3FTvYUe75OrZVU7CalU9vd2abRD23CRm xX7WaB4thr46lFC0yp9Zwc5xak4w32uSMfvy0E3xoWjyYebrruQ75zqkvPOi+xP03oAO gRUafo8kitRcbkqE7Zs/sXTC51ioheHucWQfW458DQ6TMi2+Uar58QQNS1kRtjxFft0J hLVMBl48n/KCywyMtlLpZagAi8goaZq6atZETyC1RT7DjnnPMGmqZWl6NS6fqAFtt70k GMzijRMUBQWBmiq8iscCuzwsKKfcK5vvRHG/rdu76kuO4GOats78J722NqSpl6ptgirq vLHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=kOPOQuVW2mQDEUu/vdmrygAXVon3Ak9fMFR1ZN1UH4k=; b=ajO96TfAjFFgJkpFrOjRZAl38zBqdKcoNImRDK/7n1awQBSyOkNm07eK1hk9ULN/SC /Xkb6sHYmyiiZHMFinKUi1ZxXaycawFijeBOUZPR+kocOisBY4pIga8djhWZbiTlJOST 8got7oswFQ+W4cxbsAEjLjNn72Oi7pQ93eh6h4RnatiL6MwqkByUl3jTof/yOmhNd8K+ x+RsUCHAJ8BaIVNZjjQrfzKnNpIN3VexgkyrbNNjanan9V8sO3m4zLQ8Wmja1AYdgtRm D1moTDTPdxoo7Vbv/QFj9Uazi4I+n9f7CVmL+Hp9wt0GLpQneaE12Ywf8cm2jFcNZMie J8mQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="RRN/etES"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l23-20020aa7c3d7000000b004acc19b2698si164964edr.162.2023.02.15.15.06.01; Wed, 15 Feb 2023 15:06:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="RRN/etES"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229892AbjBOXDp (ORCPT <rfc822;hadasmailinglist@gmail.com> + 99 others); Wed, 15 Feb 2023 18:03:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229743AbjBOXDn (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 15 Feb 2023 18:03:43 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E48B902E for <linux-kernel@vger.kernel.org>; Wed, 15 Feb 2023 15:03:11 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A0E1D61DE7 for <linux-kernel@vger.kernel.org>; Wed, 15 Feb 2023 23:03:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89883C433EF; Wed, 15 Feb 2023 23:03:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1676502188; bh=UKPr8oh22HzQYTrLgMsIu2vdyosO47eeoc8UdL0ln30=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RRN/etESUyuiZB3K3jWcCHT/Vlvrlx9cP+9haAT0fEkyexVuIGTJczYfGWgHa36/V qRLIIOF+FjArs5oN4Qcd6izqOzLs16cg5Q+yz7S+xxpkmVPaggs64E2UTIZbwIRlXZ SEjpDrkQY2duscuoD2Lz75jV8cy4Wx7qHvd3yKk27HUNxX8DgtJOFrJxoB8ZhFxiCv QKCc0MghhRzIrI3MESAmaMyiZAwyDSxn4xRC2UaIZEwP90cf3OCuO+DvULghKkjn8d qdSrtChI4nh242kgB2Luputd0TQfHj4lvtrA05S1Fk1ALjbwtXG3Ps7EUa0ijWYpwJ YaVHgucqHaCiQ== From: SeongJae Park <sj@kernel.org> To: Andrew Morton <akpm@linux-foundation.org> Cc: SeongJae Park <sj@kernel.org>, David Hildenbrand <david@redhat.com>, Oscar Salvador <osalvador@suse.de>, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/2] mm/memory_hotplug: return nothing from do_migrate_range() Date: Wed, 15 Feb 2023 23:02:59 +0000 Message-Id: <20230215230300.61125-2-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230215230300.61125-1-sj@kernel.org> References: <20230215230300.61125-1-sj@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757940164558726408?= X-GMAIL-MSGID: =?utf-8?q?1757940164558726408?= |
Series |
mm/memory_hotplug: cleanup do_migrate_range()
|
|
Commit Message
SeongJae Park
Feb. 15, 2023, 11:02 p.m. UTC
Return value mechanism of do_migrate_range() is not very simple, while
no caller of the function checks the return value. Make the function
return nothing to be more simple.
Suggested-by: David Hildenbrand <david@redhat.com>
Signed-off-by: SeongJae Park <sj@kernel.org>
---
mm/memory_hotplug.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
Comments
On 16.02.23 00:02, SeongJae Park wrote: > Return value mechanism of do_migrate_range() is not very simple, while > no caller of the function checks the return value. Make the function > return nothing to be more simple. > > Suggested-by: David Hildenbrand <david@redhat.com> > Signed-off-by: SeongJae Park <sj@kernel.org> > --- > mm/memory_hotplug.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c > index bcb0dc41c2f2..6c615ba1a5c7 100644 > --- a/mm/memory_hotplug.c > +++ b/mm/memory_hotplug.c > @@ -1620,8 +1620,7 @@ static int scan_movable_pages(unsigned long start, unsigned long end, > return 0; > } > > -static int > -do_migrate_range(unsigned long start_pfn, unsigned long end_pfn) > +static void do_migrate_range(unsigned long start_pfn, unsigned long end_pfn) > { > unsigned long pfn; > struct page *page, *head; > @@ -1721,8 +1720,6 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn) > putback_movable_pages(&source); > } > } > - > - return ret; > } I think this patch should also stop initializing ret = 0 inside that function. With that Acked-by: David Hildenbrand <david@redhat.com>
On 2/16/2023 7:02 AM, SeongJae Park wrote: > Return value mechanism of do_migrate_range() is not very simple, while > no caller of the function checks the return value. Make the function > return nothing to be more simple. > > Suggested-by: David Hildenbrand <david@redhat.com> > Signed-off-by: SeongJae Park <sj@kernel.org> > --- > mm/memory_hotplug.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c > index bcb0dc41c2f2..6c615ba1a5c7 100644 > --- a/mm/memory_hotplug.c > +++ b/mm/memory_hotplug.c > @@ -1620,8 +1620,7 @@ static int scan_movable_pages(unsigned long start, unsigned long end, > return 0; > } > > -static int > -do_migrate_range(unsigned long start_pfn, unsigned long end_pfn) > +static void do_migrate_range(unsigned long start_pfn, unsigned long end_pfn) > { > unsigned long pfn; > struct page *page, *head; > @@ -1721,8 +1720,6 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn) > putback_movable_pages(&source); > } > } > - > - return ret; Nit: while we are at it, can we also remove the "TODO" comment in offline_pages()? ret = scan_movable_pages(pfn, end_pfn, &pfn); if (!ret) { /* * TODO: fatal migration failures should bail * out */ do_migrate_range(pfn, end_pfn); } With David's comments: Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Hi David, On Thu, 16 Feb 2023 10:46:59 +0100 David Hildenbrand <david@redhat.com> wrote: > On 16.02.23 00:02, SeongJae Park wrote: > > Return value mechanism of do_migrate_range() is not very simple, while > > no caller of the function checks the return value. Make the function > > return nothing to be more simple. > > > > Suggested-by: David Hildenbrand <david@redhat.com> > > Signed-off-by: SeongJae Park <sj@kernel.org> > > --- > > mm/memory_hotplug.c | 5 +---- > > 1 file changed, 1 insertion(+), 4 deletions(-) > > > > diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c > > index bcb0dc41c2f2..6c615ba1a5c7 100644 > > --- a/mm/memory_hotplug.c > > +++ b/mm/memory_hotplug.c > > @@ -1620,8 +1620,7 @@ static int scan_movable_pages(unsigned long start, unsigned long end, > > return 0; > > } > > > > -static int > > -do_migrate_range(unsigned long start_pfn, unsigned long end_pfn) > > +static void do_migrate_range(unsigned long start_pfn, unsigned long end_pfn) > > { > > unsigned long pfn; > > struct page *page, *head; > > @@ -1721,8 +1720,6 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn) > > putback_movable_pages(&source); > > } > > } > > - > > - return ret; > > } > > I think this patch should also stop initializing ret = 0 inside that > function. The second patch does it, and I read your reply to the patch asking squashing it in this one. I will send the new version soon. > > With that > > Acked-by: David Hildenbrand <david@redhat.com> Thanks you. Thanks, SJ > > -- > Thanks, > > David / dhildenb > >
Hi Baolin, On Thu, 16 Feb 2023 18:53:34 +0800 Baolin Wang <baolin.wang@linux.alibaba.com> wrote: > > > On 2/16/2023 7:02 AM, SeongJae Park wrote: > > Return value mechanism of do_migrate_range() is not very simple, while > > no caller of the function checks the return value. Make the function > > return nothing to be more simple. > > > > Suggested-by: David Hildenbrand <david@redhat.com> > > Signed-off-by: SeongJae Park <sj@kernel.org> > > --- > > mm/memory_hotplug.c | 5 +---- > > 1 file changed, 1 insertion(+), 4 deletions(-) > > > > diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c > > index bcb0dc41c2f2..6c615ba1a5c7 100644 > > --- a/mm/memory_hotplug.c > > +++ b/mm/memory_hotplug.c > > @@ -1620,8 +1620,7 @@ static int scan_movable_pages(unsigned long start, unsigned long end, > > return 0; > > } > > > > -static int > > -do_migrate_range(unsigned long start_pfn, unsigned long end_pfn) > > +static void do_migrate_range(unsigned long start_pfn, unsigned long end_pfn) > > { > > unsigned long pfn; > > struct page *page, *head; > > @@ -1721,8 +1720,6 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn) > > putback_movable_pages(&source); > > } > > } > > - > > - return ret; > > Nit: while we are at it, can we also remove the "TODO" comment in > offline_pages()? > > ret = scan_movable_pages(pfn, end_pfn, &pfn); > if (!ret) { > /* > * TODO: fatal migration failures should bail > * out > */ > do_migrate_range(pfn, end_pfn); > } > > With David's comments: > Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com> As David mentioned we're just still unclear what issues are fatal[1], I was thinking we didn't forgive the future work, so left the comment. If anyone has different opinion or I'm getting something wrong, please let me know. [1] https://lore.kernel.org/linux-mm/388b9a93-423f-33f8-0495-2a4a290fd1aa@redhat.com/ Thanks, SJ
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index bcb0dc41c2f2..6c615ba1a5c7 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1620,8 +1620,7 @@ static int scan_movable_pages(unsigned long start, unsigned long end, return 0; } -static int -do_migrate_range(unsigned long start_pfn, unsigned long end_pfn) +static void do_migrate_range(unsigned long start_pfn, unsigned long end_pfn) { unsigned long pfn; struct page *page, *head; @@ -1721,8 +1720,6 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn) putback_movable_pages(&source); } } - - return ret; } static int __init cmdline_parse_movable_node(char *p)