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: 13142296 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D014BC636D6 for ; Wed, 15 Feb 2023 23:03:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 719956B0074; Wed, 15 Feb 2023 18:03:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 67B566B0078; Wed, 15 Feb 2023 18:03:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4CE2A6B007B; Wed, 15 Feb 2023 18:03:12 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 3C9926B0074 for ; Wed, 15 Feb 2023 18:03:12 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 0F9B11C636A for ; Wed, 15 Feb 2023 23:03:12 +0000 (UTC) X-FDA: 80471053824.18.414FF88 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf23.hostedemail.com (Postfix) with ESMTP id B2446140023 for ; Wed, 15 Feb 2023 23:03:09 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="RRN/etES"; spf=pass (imf23.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1676502189; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=kOPOQuVW2mQDEUu/vdmrygAXVon3Ak9fMFR1ZN1UH4k=; b=TPCKpLKYeg3p98I9vY6R73kKpv98QHh+MN6G4O67bOmuwZW3UNA4jEvRxq3ZxF3FoazaUS BI0SHJPBreTo6adh2FR+JPnccoPYq3cB0CW9ZyXU8XiuTDOG2ExC07lVCcVSrywIVB9QNi nRPNBhcdQL9DhiCYY9pvOr6iBKN2IMY= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="RRN/etES"; spf=pass (imf23.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1676502189; a=rsa-sha256; cv=none; b=sQoWOUbcy8e6GzL4FLxOO/ICvUMcCtxx3r50EEg72STU+v53EoMUDf/GCI8ne374SOa8Dv f9C7HwKyttzFqO2+9kleu2ZPdInrflElti31TSgpDYk8YB048LNxS8ULCHl8JNGKIGSF4K CdDvk+nnNSjtUrL1oTyXfldiSP0zCvA= 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 985CE61DC0; 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-Stat-Signature: 4ht7h3hxd9os7ufykabup67rcsuiitr5 X-Rspam-User: X-Rspamd-Queue-Id: B2446140023 X-Rspamd-Server: rspam06 X-HE-Tag: 1676502189-561467 X-HE-Meta: U2FsdGVkX19AIS0m1VpobUnxS70U/D8/qkdSDIMV/Bayh9zN8LTZFf49DxnUirPioTfde/vZuSM8LLSESEIT89CdI/AqyLwlEtZ4yza8HWOJf44qcdZUl/8YJepfCXqijtXrFT6qfunB6prOtq1AUdgdGzQterNIwDxr8D5heOoH5Hm8Pk/tBEz8EujAedXLo/EASlMC7F5I20mz8MlB0fMjY/d03I4ZrgFQh3YU0Hcth/Nxc+qcvKRwObYt4ISroUFloFKR1rgkpahYECKc5p6t0wQuYRz+gV9OqfNkfvwjNLAZmUWxyV4VckkUxl5AoLfiQNB1REV1JOuh4z0EJtQl6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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: 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: 13142297 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0DA77C636CC for ; Wed, 15 Feb 2023 23:03:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 963826B0078; Wed, 15 Feb 2023 18:03:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8ECDF6B007B; Wed, 15 Feb 2023 18:03:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6F0836B007D; Wed, 15 Feb 2023 18:03:13 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 591DF6B0078 for ; Wed, 15 Feb 2023 18:03:13 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 23302A67F6 for ; Wed, 15 Feb 2023 23:03:13 +0000 (UTC) X-FDA: 80471053866.05.7AC4886 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf18.hostedemail.com (Postfix) with ESMTP id 7F17C1C001B for ; Wed, 15 Feb 2023 23:03:11 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=s1qOOoej; spf=pass (imf18.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1676502191; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=6m4rS7XvDPz08fp+7RpIHbxlPCP2MBHHGak1Fkfrxa8=; b=nJOtf3WppqKK9RB3Y0/L+oMsbApgfSgBozOomkqvpXqzKQ0Xkx/NxyigGyL2lXYjNiK5vE miIIESyiwrN5eVnkS4UrFFSAakG5ZfsGTADxH/Ih/dFSVlLeuIXgVk5Rcrrvx9g+HN9hIq rAsSFPJuiB/V/2hXgHRMnbkYPm+xh+w= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=s1qOOoej; spf=pass (imf18.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1676502191; a=rsa-sha256; cv=none; b=7DrxTheWmqZnbVpuIpZtv7d8ukGcWeDNrWAX0SSp+DX40NhFtnq2UQY6Owl8zTWuqPvS/x I1lz+0hcIrirRr814CfU97DCTLaJTl+jYa8W68vKLKqUiBoNNmmiAne0Die3aUkJzgoF45 6Ha7n5e0dpZ17GR7ksreexUXApqwD+k= 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 8572861B43; 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-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: iejj5tkczxrjfopkrxczi1b8jy768k44 X-Rspamd-Queue-Id: 7F17C1C001B X-HE-Tag: 1676502191-135420 X-HE-Meta: U2FsdGVkX19cQQ/dQ10meY/AXFO9gUKqb2IcVbvbpYKbovJD1tMLZVYF4KGAnEFYKWudEy4rmnShVF8xy5HoTaA15KftqzZaXFs3V8FF9o6igR0VXqQ0JHjpdevqo1pyyU9IIDRwK536quc5p+ePDyR/VqlGdej/omxsGyADKkvvTU64emrltLRZpm0QKVibzowJI/VOTqlGLqWWEcRgg+y6iX6QITCuiNy7rkim8GFD2CxHaLAdrTy3LPEb3MYQ027wIJc7DWlQPO77DH7r9LP0XBQ5V/N6xby7bNXAcnCrJsOTwEXb6HJIM6nLRQbZXGgC9itVrhg7dJ3Q3WFNKdz6Z3yEoIwWfOwK5UBL7Pc0u7Ws3Fh9Ilb3qi1fU8dtAKwYBetcDZA5OFOk+0jK1sSnRPQ/Ocn0X3bxD3IQL0v/dhMZ2mdNblstCS/Fihepzqa5B9hJBj5uXZb+0oNZP5h8YX9P+doq+ILZCPqrpHvYd2qXmCSW0vQDEa5tphN+JpxE0BnQ0ZhA4wrOxL6+jVMYT1ryZxamNynln3QIQbeaES1hFywbVbS1dbAuMZbr/0M0nYzRQi3Gk9n7hyB5B9cxlL3MTGeVsfrPdMx/X8u4HChvnQ8L00oplPWPxJ5UJvi9laU+E2a9uEA6ShVwUjml/TuR9lAYVnq0LoANj8+fo2ouocSkJTVSR13hdx5Y2SNiIlQfBW4j/+POWAkANM5LWK12zvijwVr4SZLHr1azDHURJgV479wH5B7aQBTABLfZYyzr0NccaszW27mMIxQct3rkZxIpZGLjuDkDcnYSrjmwMvmXx4rMo4QMlR5a3UOqZnMWbmHg2ImVYVo+KDl6MKEDwEOmHJSwZfL6VkitZAqqDkOv1SGQimLJDEAVL8vWwxzmLOt6k98dZru5UH5Zvxn+FTrm6jBOPvgaaTvd7CwdyK4DvV6FiGde9dJrGc7MJHE2qLtOhQ2u0mu jqWU1t9A LILlZ7j6C5NCdY5YUhKDWQBPCfKWdcX0E52VI3F1QLEKnZTysOjxsVZnio5DS+Nhd75zLNBIV1jC+f2dtMXd+98N19mKB51PBwH1k8exCPyVWrCkQEIRkx2/pNo8MxNqIuDvH62Axt3N0raR8uFenYabc+8bmAsGfWNLmOapfVPN/Ef8qLhfWC6e4n4NBvrkiZiScfaEirk6gY74GWWS3sdVUmfsqng3Wrdc8YbE2vYzFNcW3FdqnlbQ4o2HUExpu0LSqgERzXyLxqKLJbcoMUfTFP71KWLBBwAx5a6VOsHIaqJtli22RS6vE3VjW3epeAoxQltGXENt8/8uReAZ5gBYvUqRxRkDOcw7w0YhhcObe7zZCYG68AOsLAkNB9WtUv+LHUr057q6c0/l073ScERhxlA== 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: 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