From patchwork Mon Aug 21 11:56:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13359342 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 DC2BCEE49AC for ; Mon, 21 Aug 2023 11:45:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5A4308E0002; Mon, 21 Aug 2023 07:45:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3ACAB8E0008; Mon, 21 Aug 2023 07:45:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 187A38E0007; Mon, 21 Aug 2023 07:45:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id E441F8D000C for ; Mon, 21 Aug 2023 07:45:41 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id AE98A1C9A56 for ; Mon, 21 Aug 2023 11:45:41 +0000 (UTC) X-FDA: 81147932082.10.8A704A5 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf26.hostedemail.com (Postfix) with ESMTP id 78F20140007 for ; Mon, 21 Aug 2023 11:45:39 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=none; spf=pass (imf26.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1692618340; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HnLaJls1IH72MtR6jX/8bAnP1g/8utXa1KLvGbePzRo=; b=X5UoLVUVKIEp194X6SZ05eIl8+NUrqiF/Vlfunt2HnIrDTsSVLtDqgPMGShWYsawlWo2F6 ddB5o7PWe/3myE3lLbecokbHYqGy7iWzA02rLddsod8Zj36y2eQYgSivMJCl4EloVMj6Nn 9J0+iiMPZQ8CJN1ERk6XbitsjI5G3YM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1692618340; a=rsa-sha256; cv=none; b=Em95k9cM3TOeQjHRwS5LCoifSJSmSfb8L7cOUHEt7HVfWfvyTyOaEIrb1puHlGVyRxjgro 6loqs/qUOCmbcLT9idfe4/kPNFoO3XByO+CYO9CLaapzSNd0LYXiHVQzSCTH3IeyJyTEhm 3n9ewPDDnpKATSoI9OhCUXBLBUWaVbY= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=none; spf=pass (imf26.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com 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 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 X-Rspamd-Queue-Id: 78F20140007 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: 91gbyumqq1o8ntct335j3fcsegz7938c X-HE-Tag: 1692618339-56591 X-HE-Meta: U2FsdGVkX1/weC2M7k8rCBERN5pDCuNBvR778Evh4Cxeo3uR4YRkWTR5uGwzJPV1yQ24r5Vm/CUXJ31gGs79/K0dUXsIoMuhoFrXaCMkVagcUnNUCwYn1Qfsv2/QD4yyF9f26uo40Ox1S0ouiWAMnWpODBiHGNkwwdJbbq5Pj/Jvv1ImdxkNx4D00arMLQldnzPyZeBqW83Q/e+XwkCNzEEUjsDpZpWH08J/mf5rZAC/M1HXDR5XuNj71ugcaFnLmqtQioR+Q2OMN3/ef+s/lEKvM0+Xfze7N0DimOVBRgON+SJHfGtajj/C7V7UktXJsGaAWLvQOyo73xFWhkZWbtMNhY5C2ioIyx9OWVa10XrnPMhnbBLyPzDjgpbH8gSaP9Xn7buBnGz33J+TDAcEO7703koJ3dr+0HUNZnhl24wUzHc7W/2ZVL+z81K8P4OgdBGwpoiYdFJ2cLOHpqGm4ePDCByvh+sp5grJIHFNM8YDHBP3/2liMm7dpFjB9Zsng89WcJAV/HHr1j7zG2AN7E2LVPwpmlNZ9SiwYMUTCyC0n668kIK7M8nqx2bQx//k/mxUy/o84NtgDRoycHJ9Gs7GX1uyY9OgomogvmWU5OzT9Xs5/c8GSA66TogOtB0fW1f/cqu7iLmxQ1cCO5DNmn+26pEwTdtbQPkqXISOhqUBY1QRhlht2ThFz3wA65rvax2VECh4KnaFpJNYoVX3blB/8Kwf36U8023cYIZwvk9GmpNifwpBqE2PuBnz4JNuqz0n5tdBiKgtP3pKLRpopICrpZGMU1rzcUMFS/iTo+lIQhPMdUvg1dB+8YtaZvAV2XYFOrphzEUdykjaf+lhBjerZK5VTlucawGEtWNez+GACf9QWgtl1adQB9Oy3uvZrb2ylebc+KmgpoT3kc+zqtruaJsHMiGGeRSQrd5Swy+GiaLirY80i3l35c0/hS6F5cDRmgxdEXLU5i6zURK /0eBgQsl msu4zIPqmb86PuprFWzKMd5dg3iyrhMNvrFQwTR1RaEyHiCkgFh5C0V7Wl+VtHVSmCx/Vr6IXMoRYq9YTWT8SuQ2v8sdvpmMHSrpM9LUosMPmpLoye3tCetgogPX20IZitMH0JRZ/00Ha9QZawrAPzXFEKu3FHQyyYla152qYv9HMPLCZDTVYjiNDeeTj+1TbVRf0rIm1tT03lSOm2eT6j/avpJUXcHzQCOF7NePll9BV8wol/QoTz+V1Strh/eFzVHDhRCW/AgGmVV0I5Gx/N31UgYMOFhdC4cB3ceKEHuYOoI0= 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: 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; if (folio_test_hugetlb(folio)) { - if (PageHead(page)) { - isolated = isolate_hugetlb(folio, pagelist); - err = isolated ? 1 : -EBUSY; - } + isolated = isolate_hugetlb(folio, pagelist); + err = isolated ? 1 : -EBUSY; } else { isolated = folio_isolate_lru(folio); if (!isolated) {