From nobody Wed Dec 17 14:20:36 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C16D7EE49A6 for ; Mon, 21 Aug 2023 11:45:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233422AbjHULpz (ORCPT ); Mon, 21 Aug 2023 07:45:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233173AbjHULpt (ORCPT ); Mon, 21 Aug 2023 07:45:49 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB4EDE2 for ; Mon, 21 Aug 2023 04:45:38 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4RTrDW04YzzNnSZ; Mon, 21 Aug 2023 19:42:03 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Mon, 21 Aug 2023 19:45:36 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Mike Kravetz , , Kefeng Wang Subject: [PATCH v2 7/8] mm: migrate: remove PageHead() check for HugeTLB in add_page_for_migration() Date: Mon, 21 Aug 2023 19:56:23 +0800 Message-ID: <20230821115624.158759-8-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230821115624.158759-1-wangkefeng.wang@huawei.com> References: <20230821115624.158759-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" There is some different between hugeTLB and THP behave when passed the address of a tail page, for THP, it will migrate the entire THP page, but for HugeTLB, it will return -EACCES, or -ENOENT before commit e66f17ff7177 ("mm/hugetlb: take page table lock in follow_huge_pmd()"), -EACCES The page is mapped by multiple processes and can be moved only if MPOL_MF_MOVE_ALL is specified. -ENOENT The page is not present. But when check manual[1], both of the two errnos are not suitable, it is better to keep the same behave between hugetlb and THP when passed the address of a tail page, so let's just remove the PageHead() check for HugeTLB. [1] https://man7.org/linux/man-pages/man2/move_pages.2.html Suggested-by: Mike Kravetz Signed-off-by: Kefeng Wang Acked-by: Zi Yan --- mm/migrate.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index 73572d5a5cd4..e8c3fb8974f9 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -2093,10 +2093,8 @@ static int add_page_for_migration(struct mm_struct *= mm, const void __user *p, goto out_putfolio; =20 if (folio_test_hugetlb(folio)) { - if (PageHead(page)) { - isolated =3D isolate_hugetlb(folio, pagelist); - err =3D isolated ? 1 : -EBUSY; - } + isolated =3D isolate_hugetlb(folio, pagelist); + err =3D isolated ? 1 : -EBUSY; } else { isolated =3D folio_isolate_lru(folio); if (!isolated) { --=20 2.41.0