From patchwork Tue Nov 29 19:35:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 27460 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp535274wrr; Tue, 29 Nov 2022 11:48:14 -0800 (PST) X-Google-Smtp-Source: AA0mqf43MFxUnY+r5b/Fsd0XYX4h3ldITSxGcdDyQH+FlR4gE7QWDKMDoOKl1igo6yKin3iIs88n X-Received: by 2002:a05:6402:114f:b0:462:1e07:1dd7 with SMTP id g15-20020a056402114f00b004621e071dd7mr53967815edw.293.1669751293891; Tue, 29 Nov 2022 11:48:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669751293; cv=none; d=google.com; s=arc-20160816; b=z7JwXzI++Uaxv3W7DJ0U54FvJBuqRah2Wqs0sqnc1Pe0NyAE0umAl4rPyWBjcne9Sg hHFDwEiLjfZBOtdTLli+rx4EXZC+DVagKCznavDjmQnPhtUKcJvY3uHMDLy+lXPkU0xX HJFWorR3YPNyMl96SSOaY6GUjhy8eUJTxpnQjGsoMh6jUIlJfYGYo6yhLSLKK/Fx2HnW lF1CYaXMU9S9BuUQbnTywmKqRbbDKKfU951SWNNn+M4f5s7LL3SYUxnroZkj7D5OF4Ev rLuqxqcBo3TcZOBtTcIgM/z7dkvZVmiG3QuVw8VKRD3HNN+WDe579e6KBnYTerIjck44 tveg== 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 :dkim-signature; bh=069LEwdmpjbCoEgrG7X25LyQKpeCovMtZOQCiu77QNo=; b=uTv9QPWX2Df66lGqF6wLtg7IPJyVmLi3ZN+Ej4TrqmurYmRkVGWT/RKIsYVuSP/+n1 8PDJ5p/di3x5bdsl+G80l/akUpvb47MRO0pok59cCbO71UbBRMrCbwqvOuqXgT2pPk7v /NUJ97lwDn1Drh9FKxW8/z8RRMdtzZbeSezs0u+nEpXqsbiBU25WxuoGWPh4p6mpSHcN VBvUvRWwYXx5Rjoghs3cFtbvnwp/1edZkyDpcWOSJOXZxRQCg1h3bJtuNZsDOolPvgf5 pVbmfKECNQGX9+UBcnRwYxjXLT/+pbQHFvGbpLxPIYucKFJmX2WDdII6jZIlhaY/uRmR Rapg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Rfxez/FP"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nd22-20020a170907629600b007877f3132d9si13250249ejc.438.2022.11.29.11.47.50; Tue, 29 Nov 2022 11:48:13 -0800 (PST) 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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Rfxez/FP"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237046AbiK2Ths (ORCPT + 99 others); Tue, 29 Nov 2022 14:37:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237100AbiK2ThE (ORCPT ); Tue, 29 Nov 2022 14:37:04 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7088B5B865 for ; Tue, 29 Nov 2022 11:35:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669750535; h=from:from: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=069LEwdmpjbCoEgrG7X25LyQKpeCovMtZOQCiu77QNo=; b=Rfxez/FP9JJaudHFIXy4W5UtTsBr5aMRRqpt4QbucuzCXp2qwJtSb/RckuK3/fRrxeZE3c EwWofrqsM26KyfSP663WyWgCTDrrFr4qXnKAhd7oFht7VDx4yCwmfa6zN4gIsk9T2x8I2j 446K7zzGYtN/mhIsTZInKoShtPwYTrs= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-115-dgg8WBogPbebm8-WkaycRQ-1; Tue, 29 Nov 2022 14:35:34 -0500 X-MC-Unique: dgg8WBogPbebm8-WkaycRQ-1 Received: by mail-qk1-f198.google.com with SMTP id v7-20020a05620a0f0700b006faffce43b2so30637050qkl.9 for ; Tue, 29 Nov 2022 11:35:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=069LEwdmpjbCoEgrG7X25LyQKpeCovMtZOQCiu77QNo=; b=PprMjNl2kr8/RPwgLp7H19MEUsnQo1bffNVKGPnmJESYTs2RJNj43xwpv/H8rUJbq4 QMKVJloqJ4nh9hukGVVsc7apZrUEJ19tuBtdl+/P5jUzFs5/nzjAd3W+DpdLsjrs9DTF tQhDDlh7Jk2dq0U2Arp59ee6QzywZ2EmW8VgfsfUDVxQV4tBsFNOS19sNT5bD3/rY7Ou nPpPBSObIQiDoI473Z4HkYTzXT3RR+2VIRDxf4jbwQeK2Ud7hr64lrA7WZNxbCQQ2v60 XHKlB1NOJ2CQaEPH3sfQuyqVT1bxkAR0OdovQW9rhTKSPuFiXg4tTbh8LqGZD6Pf2aWX Y5tA== X-Gm-Message-State: ANoB5pnvrBlmCf7tCektNwRwcjt5k+RSJ4+i9IDEW1E/3x0KctuHfY1h D0Vz0JbCxYOSemSeS4B782ZhAYBuS8Xwqm6+vG9YX+I8tubESDDxPhZKKwPSPL24DYCyRzO1RjB t1i4hv5S9iN+WkvfCOAEMvxg2 X-Received: by 2002:a05:6214:3b0b:b0:4c6:fb71:d337 with SMTP id nm11-20020a0562143b0b00b004c6fb71d337mr12678553qvb.110.1669750533675; Tue, 29 Nov 2022 11:35:33 -0800 (PST) X-Received: by 2002:a05:6214:3b0b:b0:4c6:fb71:d337 with SMTP id nm11-20020a0562143b0b00b004c6fb71d337mr12678530qvb.110.1669750533458; Tue, 29 Nov 2022 11:35:33 -0800 (PST) Received: from x1n.redhat.com (bras-base-aurron9127w-grc-46-70-31-27-79.dsl.bell.ca. [70.31.27.79]) by smtp.gmail.com with ESMTPSA id n1-20020a05620a294100b006fa16fe93bbsm11313013qkp.15.2022.11.29.11.35.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Nov 2022 11:35:33 -0800 (PST) From: Peter Xu To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: James Houghton , Jann Horn , peterx@redhat.com, Andrew Morton , Andrea Arcangeli , Rik van Riel , Nadav Amit , Miaohe Lin , Muchun Song , Mike Kravetz , David Hildenbrand Subject: [PATCH 02/10] mm/hugetlb: Don't wait for migration entry during follow page Date: Tue, 29 Nov 2022 14:35:18 -0500 Message-Id: <20221129193526.3588187-3-peterx@redhat.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221129193526.3588187-1-peterx@redhat.com> References: <20221129193526.3588187-1-peterx@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750861132761616719?= X-GMAIL-MSGID: =?utf-8?q?1750861132761616719?= That's what the code does with !hugetlb pages, so we should logically do the same for hugetlb, so migration entry will also be treated as no page. This is probably also the last piece in follow_page code that may sleep, the last one should be removed in cf994dd8af27 ("mm/gup: remove FOLL_MIGRATION", 2022-11-16). Signed-off-by: Peter Xu Reviewed-by: Mike Kravetz Reviewed-by: David Hildenbrand --- mm/hugetlb.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 9d97c9a2a15d..dfe677fadaf8 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -6234,7 +6234,6 @@ struct page *hugetlb_follow_page_mask(struct vm_area_struct *vma, if (WARN_ON_ONCE(flags & FOLL_PIN)) return NULL; -retry: pte = huge_pte_offset(mm, haddr, huge_page_size(h)); if (!pte) return NULL; @@ -6257,16 +6256,6 @@ struct page *hugetlb_follow_page_mask(struct vm_area_struct *vma, page = NULL; goto out; } - } else { - if (is_hugetlb_entry_migration(entry)) { - spin_unlock(ptl); - __migration_entry_wait_huge(pte, ptl); - goto retry; - } - /* - * hwpoisoned entry is treated as no_page_table in - * follow_page_mask(). - */ } out: spin_unlock(ptl);