From patchwork Wed Sep 13 09:51:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 138729 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9ecd:0:b0:3f2:4152:657d with SMTP id t13csp973731vqx; Wed, 13 Sep 2023 03:05:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG2Yifwti1i8TYWq0aVJ1Bhf/DVB87sbpzpLViAESRp0BNG9zxA1JyPS9UXbsL6sDQfciQR X-Received: by 2002:a05:6a00:2d9e:b0:68b:4e07:133f with SMTP id fb30-20020a056a002d9e00b0068b4e07133fmr2178615pfb.7.1694599511134; Wed, 13 Sep 2023 03:05:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694599511; cv=none; d=google.com; s=arc-20160816; b=m0AEyzOZbXaG+lod3S8CkLO3wD9YnKDFFQuMw3FshE8kinA95wLZFWYsrMtOhWz9Il vjYy5JwfX2mRt6vrCJ1G+LILRkV2YWJA+eRWs8d+003YYIOgvOhG93Ehgivu8KNHuNzn rOo8r1WfrwzDJaCxiWGbrftB0dnSUrLOouLvGhIHUfgFa7ai4nvza1duvjzYf08+cZa3 TbQl8pdB3zWMb+D5/ZINeuLGTmCRv2bQmkpqJ/L4TKGVNW+zd19ZJtpzMOw0TvKF2n9S RFPueYREh6aIdZ6By3c8m0t+xkpSyjfHyRc78gjgs1N6ol9pRb6SIvZxtxeEiHfuYELt Ovew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=edCISLjT6+ZkLMLK7dCnKkIlBAZTUznn0Sy9MjDom88=; fh=Je6qNyAM729b1goCtB6PkBk+yQrlQCIjJMRY6BFgKTo=; b=ixn6Q0qJp2+RwtSviNTjh+/jfxkty6FE6PmqMw0WooAQGaPWESWSRFzsY/itmS9PX+ ebmEYp3IedVh2wamzy4qdrmoPSqunq8luPZMt31mCzt90gL+bzvNscWD7cCzwR5A2ZkW wirCIQOvZNZ+juwreZUWYRvRdzdrFrcqaMjmFZBnHKKHrSwD+s4URTZlX2bQvihgcNqF k2JTsWZS9BilNV4D5n5zNzPJIn/eAgDM3/AwRNqtPl35aJ302FgdpxLVqIM+rQx78iEr ZY42gZK2sRIe/ZyLUdRRKVVlkRRJFBnn84ufqu8S9WygN1oLFrJQR5/TcmsXRUHdWTgW QvGw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id q140-20020a632a92000000b0056532a83c64si9473058pgq.516.2023.09.13.03.05.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 03:05:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 451C381B8958; Wed, 13 Sep 2023 02:52:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239584AbjIMJwU (ORCPT + 36 others); Wed, 13 Sep 2023 05:52:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239486AbjIMJwI (ORCPT ); Wed, 13 Sep 2023 05:52:08 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6272019BE for ; Wed, 13 Sep 2023 02:52:04 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Rlwcy4tMkzMlLX; Wed, 13 Sep 2023 17:48:34 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) 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; Wed, 13 Sep 2023 17:52:01 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Mike Kravetz , , Kefeng Wang Subject: [PATCH v3 7/8] mm: migrate: remove PageHead() check for HugeTLB in add_page_for_migration() Date: Wed, 13 Sep 2023 17:51:30 +0800 Message-ID: <20230913095131.2426871-8-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20230913095131.2426871-1-wangkefeng.wang@huawei.com> References: <20230913095131.2426871-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 13 Sep 2023 02:52:35 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776916377408652858 X-GMAIL-MSGID: 1776916377408652858 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 Acked-by: Zi Yan Signed-off-by: Kefeng Wang --- mm/migrate.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index cf5c9254fdad..7b07c97f5a6f 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) {