From patchwork Wed Feb 15 23:02:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 57765 Return-Path: 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 + 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 ); 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 ; 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 ; 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 To: Andrew Morton Cc: SeongJae Park , David Hildenbrand , Oscar Salvador , 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 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: 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?= 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 Signed-off-by: SeongJae Park Acked-by: David Hildenbrand Reviewed-by: Baolin Wang --- 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; } static int __init cmdline_parse_movable_node(char *p) From patchwork Wed Feb 15 23:03:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 57764 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp466815wrn; Wed, 15 Feb 2023 15:05:51 -0800 (PST) X-Google-Smtp-Source: AK7set8BqVN4U9KJ6y8NXPg+997zDZOrzbFlEMnjzYEvRgEWTFhpkbG5Ra4x8ItZCs0wIfLRaGT4 X-Received: by 2002:a05:6a20:3d96:b0:c3:3ea7:e318 with SMTP id s22-20020a056a203d9600b000c33ea7e318mr4286276pzi.42.1676502351073; Wed, 15 Feb 2023 15:05:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676502351; cv=none; d=google.com; s=arc-20160816; b=d1DHM8o2A0yI0FY/iiDCMPOulwY1BhgJMZakG/Ky8bBKNDwzX8opo77bFDY0yfVzRi 5XnFBE7RobSDhA7K1nDXVRnKeloo6JaEZn5f4GCEvf9EvmUOuI/zm1MnCwPxePmspP0o cok/OnV4Pr2sMpm25hZ/dcZ3bCWZ6t6uqSMP4d3ynDVXd1A7fm42Cx3tqJNxTs/Pqsvu YxlXN4iqeLtVsAJFS8lzOihIBp/X24/5CU6cHH+oUhMX4N7f0e1GMpntL2n4akYwurVT 6y7IVTHYteeNp1oFbw7V6MrkgHns0JUUimaxRfixX78GxUkVLYfHOfgbW+/vhQJoKYXr Xk2Q== 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=6m4rS7XvDPz08fp+7RpIHbxlPCP2MBHHGak1Fkfrxa8=; b=E7z8wAmYPTX0gJv67YruzEnAHBu/zwysQwpkhe/yBmP9LHlqvERel/v7MgxNVAbbDl 1DMHTso4OmUyNEA0XUGVGuIkScWnYgVNSmA2FtMn6S69sYgO0WdEG3XAJldvr1/ds+Pk ZryHKOUY6/TN/4Dv7ZNFjRqLR5B9z8fr1y/hX4+lhgVXqS/WFBFN88clrK9N2RkhYYsD y3Oq0E4vc6FBaAr75lANRvWPk0hrd0M1ILnDPAGqWq7gufzf4d2Plf9xXloCKbuNOswM q/bZBlIKVo7gQc8CBpTPhH8c+aSQRNsch/wq6JpFRaj1lZfILvSbg/2B7GzY1TMNwguw oFFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=s1qOOoej; 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 t71-20020a63814a000000b004fbc5c96d03si8693156pgd.696.2023.02.15.15.05.38; Wed, 15 Feb 2023 15:05:51 -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=s1qOOoej; 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 S229968AbjBOXDy (ORCPT + 99 others); Wed, 15 Feb 2023 18:03:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229961AbjBOXDu (ORCPT ); Wed, 15 Feb 2023 18:03:50 -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 920D04EEA for ; Wed, 15 Feb 2023 15:03:15 -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 8576361DF9 for ; Wed, 15 Feb 2023 23:03:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7268CC4339B; Wed, 15 Feb 2023 23:03:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1676502190; bh=RmZP8LXAzXmudAg+WjCvMFE/Rw2yf7ik6Dcir0mGUhM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s1qOOoejtZrXM/pP10mBRqvPAG1L4fZ0yzMF0eEpRzrsxlY7q5mH6PtWJfnS3+G/h Z+P5+9uuX1bdPD2EziZDwA5lavk/1+NcoXtLG8uTB2v/5ETkoUDOd0wjznXEsDfPxQ o5la/zXRqePYzas3GMlRCESF02FqLzM6ep6oZvumR561NMLJ8SQC7mrYLjbHsymXqX pLBNhqMQIG3py5JHkqFub5+4UOdaCfEpZfM2VM3p+fHtSaS4Wbc0xp9OBT/qQd6/Fp f2hue51lpamV0wFsycRxltVtyhUypmNv1oh2+KP1HGZT9QJEMzbMRokgtseDw+K2Bs j3l/out0PY3yA== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , David Hildenbrand , Oscar Salvador , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/2] mm/memory_hotplug: cleanup 'ret' variable usage in do_migrate_range() Date: Wed, 15 Feb 2023 23:03:00 +0000 Message-Id: <20230215230300.61125-3-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 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757940129546819150?= X-GMAIL-MSGID: =?utf-8?q?1757940129546819150?= Because do_migrate_range() is returning nothing, some 'ret' variable usages are unnecessary. Remove unnecessary usage and reduce its scope. Signed-off-by: SeongJae Park --- mm/memory_hotplug.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 6c615ba1a5c7..6df3072d11df 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1624,7 +1624,6 @@ static void do_migrate_range(unsigned long start_pfn, unsigned long end_pfn) { unsigned long pfn; struct page *page, *head; - int ret = 0; LIST_HEAD(source); static DEFINE_RATELIMIT_STATE(migrate_rs, DEFAULT_RATELIMIT_INTERVAL, DEFAULT_RATELIMIT_BURST); @@ -1678,7 +1677,6 @@ static void do_migrate_range(unsigned long start_pfn, unsigned long end_pfn) page_is_file_lru(page)); } else { - ret = -EBUSY; if (__ratelimit(&migrate_rs)) { pr_warn("failed to isolate pfn %lx\n", pfn); dump_page(page, "isolation failed"); @@ -1692,6 +1690,7 @@ static void do_migrate_range(unsigned long start_pfn, unsigned long end_pfn) .nmask = &nmask, .gfp_mask = GFP_USER | __GFP_MOVABLE | __GFP_RETRY_MAYFAIL, }; + int ret; /* * We have checked that migration range is on a single zone so