From patchwork Tue Feb 14 22:32:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13140968 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 0A0F6C61DA4 for ; Tue, 14 Feb 2023 22:32:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 94B926B0074; Tue, 14 Feb 2023 17:32:48 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8FB6B6B0075; Tue, 14 Feb 2023 17:32:48 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7C36F6B0078; Tue, 14 Feb 2023 17:32:48 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 6D8396B0074 for ; Tue, 14 Feb 2023 17:32:48 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 36B7C1C5CD1 for ; Tue, 14 Feb 2023 22:32:48 +0000 (UTC) X-FDA: 80467348416.07.2D0A72A Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf09.hostedemail.com (Postfix) with ESMTP id 8A60614000E for ; Tue, 14 Feb 2023 22:32:46 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=SkpDRj6G; spf=pass (imf09.hostedemail.com: domain of sj@kernel.org designates 145.40.68.75 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=1676413966; a=rsa-sha256; cv=none; b=Ls7EuOU7zEwPOFGW+81ZX6wgTC+BGGhlGQ7xYBDE+nZlP5/lSeQGly1TDQQ/VPk8TVPINl asHR1/QWrrVZREO+sBcyaMmvT95J2HThsuwmDWORfXwPa1iT7CkdFak/mYC+Z8bkEL0wKA x+cnCcxAkoT5I9PwuDKWsJIwaIveUpE= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=SkpDRj6G; spf=pass (imf09.hostedemail.com: domain of sj@kernel.org designates 145.40.68.75 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=1676413966; 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:references:dkim-signature; bh=8CcXaxMyq3iiiakfWcZLYbSdjf8ofOVAA4WOUuVyoVM=; b=AJnCOFcluQIuttAs2mv4I+1IcObt4BLj8BxlDL2dlJF6RvNfOLPPUWR4utsJJRDdH2YIIk Da0Kpb++VsHmCuSk7GoI88XcE0yTQn1nuWqQ19CW9zcl2AMQ0babh0v1HBq7pTXjIhX/MP Bm7PVrIs0/bZMgi+4PEBVkwod0lVOjI= 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 ams.source.kernel.org (Postfix) with ESMTPS id 76901B81F5F; Tue, 14 Feb 2023 22:32:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9ED34C433D2; Tue, 14 Feb 2023 22:32:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1676413963; bh=uCymYJjsvlSAxM5NzeVGbDlkk/dWJpRCAk9l/0RStWA=; h=From:To:Cc:Subject:Date:From; b=SkpDRj6GA4MjWpC9ZEdydWBG+6rhmVnxHG+cMRQ1D99RJJjTo23AtnBINs3gylKva 3NA0UCoHrWsKQLCOGD8joUhDwU9cBeiIzu4Pu1Km6XZLkLVUuXvvkGktiZ5N7kJU6R rDPqpJPsOpeyPwM4UKW4UQHsrJLHi3wRdEVJildlep5aIwP6y4RUgEsTlgDS4oGPmg L50nvmNyY7GN3vSNklsA1zaoOSxivjp+WXoP7fdug9WWL5zUknog9rv0I7NWLb3Inm HjoYn3H1+UKle3ip+Z12jXMjkesM1XMa/JTRAWsqFTGJnnXChKfOPcaYUNKUf4pOeI 2OafpudXJUC1g== From: SeongJae Park To: akpm@linux-foundation.org Cc: david@redhat.com, osalvador@suse.de, linux-mm@kvack.org, linux-kernel@vger.kernel.org, SeongJae Park Subject: [PATCH] mm/memory_hotplug: return zero from do_migrate_range() for only success Date: Tue, 14 Feb 2023 22:32:36 +0000 Message-Id: <20230214223236.58430-1-sj@kernel.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: 8A60614000E X-Rspamd-Server: rspam01 X-Stat-Signature: o5qhx91nfs78zdaqne4tn15g738y1hqm X-HE-Tag: 1676413966-298126 X-HE-Meta: U2FsdGVkX1+jr1IWbehybxqD22KcS1dJzmMwFZm/gMuNgI2PwbEGCFeHKyOCVvslNmgvy5oa6Co5kqdXAbjJp2At8zUPkgHE3e5ookRdImZrKCZaVANx75LyIgUsBfyvq3bQPjPzqZKw87d+qV4w/cUdenyH5uJzipp9g2k8THzOjllU05mT9TUy0Sf4+ir3kjmwVnB+W15PxH9xpfRSFH0O1y1lVH/Ul+0rtB4Se4ptHFPR4JY57wTPO6X4eHpvxyEi3INeR7BDvk1LwSCU9h2IITVmuIvQJCZH43VVcVcP6KRs2/K/UAqclrtBoC5btsycKCD1Ein2VheDCnwkAoKIfxLqDHuW2iYI02eACtk7Ul3rUJ5NKocTojjJW5zxbN963B8Z9HFReH9LT2CGS6vXuoohHw/KyZNUuAT36UQP+ykcuOGV4mIEZcucFJE4Kr7Oxei0hoUy596gE/id+GZTg3Eo87O8rP5dYzLvUDnQiQGTRMRDsQiFQS8F0en7lUx8yKFI9deNf8JvcEbYYvpLMgyF/fqDwGCF6RSMBOlOgf3+cOutWzsAHVzlCTDt8cVPH0ijln2xjFbeDpA4f9M9XbqNBLIqq0JohsU2SzrDV2c/WT4f63DkhuQZW8eZJDJYX9pxatInlmpUxnAc+lC/iQOr8ur0Hkx3W3HzJEDdH/ZXdCfJ48Iat6febgAf6ZEX6Dj2TXkISNnuKsW5E85JCMa0JwoXHbPjtFthzdmZk5it1oXDx3AKCJgPchD5V9H/+jnjy73NGszwyHPV4ePFMXsjh2sxH/iusPR2w1d/QuXfzqIhJzbYWe+41GdIP4ozg7Wpy3az00d/RyXXOgLTtLUBZGE1WWKKAiV4q5Zts9jSUxGj4UpG54VaQEjEA69xUV3kFPFzyWcOX1x7+67u3K+4xutswHAmd6lwm8fl+917aU2y4pJtPA0gy9i1jRGRmzcbWrNUMy7E3fm faEgyvWQ PO3/pa1SNMMwx2lJWNRxRHt0yoHRRbze6tzdaPrvbhv58Uka/YmE6ge9TsFS/6209pwSB1V1Fnnez2BYeqBhKKSYZbigYED8G0GCWhrvFkZ7i8SjeJhyr+A1nh679L4dw7qbUzrlZ7oFtdHJ4oYW5ECwLN2umjiLLwyN9/J8OQJqARFMqCCqtRhEXLdfXyckKJ0UnJ64+o1RUlcFuNTnv1REikuQmLHDlIlL9WoWwduvh3LYhINy4HLdE2gurTwamf9TzguCGJ8N57eK2FDk5ohhA+uTAa7IZA8qxOn2BG+1qelT5LBdpTHcwGrlJ6pzXD/qd3apDntenaTW9gIrip8QzlKU6/D8XU4t4ZocmyXzrJ7ClsfnuC9VV+Q8XclKq9zSS9sz/WO6aYhbFjObN3DKA4A== 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: do_migrate_range() returns migrate_pages() return value, which zero means perfect success, in usual cases. If all pages are failed to be isolated, however, it returns isolate_{lru,movalbe}_page() return values, or zero if all pfn were invalid, were hugetlb or hwpoisoned. So do_migrate_range() returning zero means either perfect success, or special cases of isolation total failure. Actually, the return value is not checked by any caller, so it might be better to simply make it a void function. However, there is a TODO for checking the return value. Make it easier to understand what it means. Signed-off-by: SeongJae Park --- mm/memory_hotplug.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index a1e8c3e9ab08..db2c02d502a2 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1620,6 +1620,12 @@ static int scan_movable_pages(unsigned long start, unsigned long end, return 0; } +/* + * migrate pages in the given pfn range. + * + * Returns the number of {normal folio, large folio, hugetlb} that were not + * migrated, or an error code. + */ static int do_migrate_range(unsigned long start_pfn, unsigned long end_pfn) { @@ -1685,6 +1691,7 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn) } put_page(page); } + ret = -ENOENT; if (!list_empty(&source)) { nodemask_t nmask = node_states[N_MEMORY]; struct migration_target_control mtc = {