[v2,7/8] mm: migrate: remove PageHead() check for HugeTLB in add_page_for_migration()
Message ID | 20230821115624.158759-8-wangkefeng.wang@huawei.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b82d:0:b0:3f2:4152:657d with SMTP id z13csp2950612vqi; Mon, 21 Aug 2023 05:02:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IERki0t6t0PZOOspxSszPmEMyrSTC8vaG6IbOsOWioZIGCcxcUnRMZ6HsBKBR84pX5if2+q X-Received: by 2002:a17:906:249:b0:99e:aeb:8656 with SMTP id 9-20020a170906024900b0099e0aeb8656mr4457622ejl.57.1692619330399; Mon, 21 Aug 2023 05:02:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692619330; cv=none; d=google.com; s=arc-20160816; b=VkzH1BgadezGciimYV5BgyLuWaZ3FT024Nz955MbgJtJzco736mEawnZBBJra/+ALX Iras+TMR0SmsqcQMHGfCiiEwcqD46sG0BNUpnPMExxDiRVx9tnml9gJ8U1fj0OpnM7VI rc9sp+XW49NCqXlqRuCyGiMNtgcPnP3Ml36uSBqzQfeVj0CNhQscRw532ZZlx3XZ3DFG v7V11BqtatAisV2vsWmYcdWtQ5dpB1cuLrNJH5kZiILmX/eao1f1OlC3+x05MTXKNTB9 Bko+ZHnXCTAarmddePsYZrnB/Hp6CXh6q9nTvrXVzCIWlDTwl0CFMNcJwMuAGAT0CnjZ SK8A== 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=HnLaJls1IH72MtR6jX/8bAnP1g/8utXa1KLvGbePzRo=; fh=DVvJTBiVFbttu4Lo4kJqW9uQ6WV1aWAR2MVr11q/QiQ=; b=sP2i1N6xg1rXpQNRewppLH/S2JpDdZ5VcQiSl0Dr/Svwxg1k5gaO9oLf9zkORJgZoi kM//hZBFidjgDAIcemGdEB6zOMWlSCPslJ2XOL6xvgQvZvIJc/tqRKGoD94/gJnDAvBJ RcakXmuMygQyvDBebCHamQdzVhbinmTRUykie2WXygP9Q5i9v3WcAAQQwjC4b0YMSBoG lFk1lIqZY7a+1fwZpz0MPTl33g0cRrh7sUNCY6bN0XKqBkIfHam6vAamIWC7rwhLfIuO q48e4dNoz4DsW1/JM731A/6KJBa8bYT4sP0IRMyooQMZ8uQdxAuvAac89hvBrCS2lsls ys/g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p10-20020a170906a00a00b009945658c5b9si5599424ejy.811.2023.08.21.05.01.44; Mon, 21 Aug 2023 05:02:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233411AbjHULpz (ORCPT <rfc822;274620705z@gmail.com> + 99 others); 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 <rfc822;linux-kernel@vger.kernel.org>); 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 <linux-kernel@vger.kernel.org>; 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 <wangkefeng.wang@huawei.com> To: Andrew Morton <akpm@linux-foundation.org> CC: <willy@infradead.org>, <linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>, <ying.huang@intel.com>, <david@redhat.com>, Zi Yan <ziy@nvidia.com>, Mike Kravetz <mike.kravetz@oracle.com>, <hughd@google.com>, Kefeng Wang <wangkefeng.wang@huawei.com> 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: 7BIT Content-Type: text/plain; charset=US-ASCII 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-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1774840006858161295 X-GMAIL-MSGID: 1774840006858161295 |
Series |
None
|
|
Commit Message
Kefeng Wang
Aug. 21, 2023, 11:56 a.m. UTC
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 <mike.kravetz@oracle.com>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
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) {