From patchwork Sat Apr 9 07:38:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12807729 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 57923C433F5 for ; Sat, 9 Apr 2022 07:56:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BAB568D0001; Sat, 9 Apr 2022 03:56:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B5BF56B0074; Sat, 9 Apr 2022 03:56:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A4BB98D0001; Sat, 9 Apr 2022 03:56:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.26]) by kanga.kvack.org (Postfix) with ESMTP id 981666B0073 for ; Sat, 9 Apr 2022 03:56:09 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id 665046029F for ; Sat, 9 Apr 2022 07:56:09 +0000 (UTC) X-FDA: 79336582458.19.1EF3C00 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf28.hostedemail.com (Postfix) with ESMTP id 95019C0004 for ; Sat, 9 Apr 2022 07:56:08 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Kb6Pn6S06zgYWT; Sat, 9 Apr 2022 15:36:45 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Sat, 9 Apr 2022 15:38:31 +0800 From: Miaohe Lin To: CC: , , , , , , , , , , , , , , , , , , , Subject: [PATCH 3/4] mm/migration: return errno when isolate_huge_page failed Date: Sat, 9 Apr 2022 15:38:45 +0800 Message-ID: <20220409073846.22286-4-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220409073846.22286-1-linmiaohe@huawei.com> References: <20220409073846.22286-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Rspam-User: Authentication-Results: imf28.hostedemail.com; dkim=none; spf=pass (imf28.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 95019C0004 X-Stat-Signature: 3mrga7955h5wcz5pdnwrphctek9781ia X-HE-Tag: 1649490968-375871 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: We might fail to isolate huge page due to e.g. the page is under migration which cleared HPageMigratable. So we should return -EBUSY in this case rather than always return 1 which could confuse the user. Fixes: e8db67eb0ded ("mm: migrate: move_pages() supports thp migration") Reviewed-by: Muchun Song Reviewed-by: Baolin Wang Signed-off-by: Miaohe Lin --- mm/migrate.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index 381963231a62..044656a14ae2 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1632,10 +1632,8 @@ static int add_page_for_migration(struct mm_struct *mm, unsigned long addr, goto out_putpage; if (PageHuge(page)) { - if (PageHead(page)) { - isolate_huge_page(page, pagelist); - err = 1; - } + if (PageHead(page)) + err = isolate_huge_page(page, pagelist) ? 1 : -EBUSY; } else { struct page *head;