Message ID | 20221107161740.144456-11-david@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2152285wru; Mon, 7 Nov 2022 08:23:03 -0800 (PST) X-Google-Smtp-Source: AMsMyM71RrhExqHeoxJwoP/maVWy/AK6ZO16Tbs2k4zfzHtViD9fKg0WIkpNJZfBl6YtQ2d2HMZi X-Received: by 2002:a17:902:d54c:b0:186:c092:97db with SMTP id z12-20020a170902d54c00b00186c09297dbmr51325126plf.28.1667838183586; Mon, 07 Nov 2022 08:23:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667838183; cv=none; d=google.com; s=arc-20160816; b=kbiBvbnK5O2E90FF6VNIMEPBSZoa5MtZBWiJQZogxzeaD5VkYhKVTzd4wE0XoE6Bv1 ggTu2kKh6RSNDMvIxlnekOns9rHC3E50FCm7apcli5MIYHUYNaeCb7ApGay7623fO4DM rW5FAYqWaMbk8eUNSQiUecNlkzi/2ZVBTuBggY5DWlevz5fD0qaAJLNH1FVYYlZvWrGo h1BJG5e2EMyD2qgwVMGasbibMOcgMQlfegNGhVM9QXOt8hqBRkK7OoxjqBzAQ5QV3a3s 45i8rlk8xA5OLDFxk8PKbzC1g1T3BhAjiP8Lk83ygISf3sNVK9saUPscVgpXLavt48fx 714A== 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=8LSm/ABK1dZuzbBLIy952PsCCtserHCfNmIiwyOpplI=; b=rv3ffo16oVAiEJndqem5KtiN+JP/AFIQPCG+EWl/xP/PUUMYzdS1ATD+SLa7Eo8zx8 rBISFyFId/iRBFKBEnDMZ8vwcG2Dn6XfQt+0w9X7q3gV0US3ewpdqSYxtoX9irXmao9q HFhOYe0kJaBMleWEU2chuYjGj1mADtfk3pBA8wSTl00NG07KIYWZvGrfHGWN9E8v8jZp EBOXJfHl8fPXWSXzkzUxEGUp704lB5HpmpacHYSKqH0skwnknPQroUlNAlT0iYfgH5mg 92rm2ijZSN+DcEuIggLoTPs/rLwy0b8/Qtdpfq5FXMr4a3jvINlbuqSLNLoCfXyvXxIx GPuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QdXKVTch; 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 k11-20020a056a00134b00b0056d568dc21dsi12556300pfu.153.2022.11.07.08.22.50; Mon, 07 Nov 2022 08:23:03 -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=QdXKVTch; 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 S232798AbiKGQU6 (ORCPT <rfc822;hjfbswb@gmail.com> + 99 others); Mon, 7 Nov 2022 11:20:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232619AbiKGQU1 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 7 Nov 2022 11:20:27 -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 2086820F51 for <linux-kernel@vger.kernel.org>; Mon, 7 Nov 2022 08:18:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667837929; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8LSm/ABK1dZuzbBLIy952PsCCtserHCfNmIiwyOpplI=; b=QdXKVTch+nHSq0I6y3tJHUEEG9nQZRZ+beh3KMv5XuqvqPmlp4EhrUIWlzJyXJcQ1LcC3z sT2lXQ+f54TZETt0FEluI/IAvU3xzHDelk8mCHB5SaMlVUKtKJUQJ5U4NmxrKBLExSp1rD qmJNx1vksOjp4aUPhgf/echDBWwgu8c= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-491-BzZ6c9HQOyGIJKIwV5MVVA-1; Mon, 07 Nov 2022 11:18:47 -0500 X-MC-Unique: BzZ6c9HQOyGIJKIwV5MVVA-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5AA663C0F671; Mon, 7 Nov 2022 16:18:46 +0000 (UTC) Received: from t480s.redhat.com (unknown [10.39.195.106]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8D9544B4010; Mon, 7 Nov 2022 16:18:40 +0000 (UTC) From: David Hildenbrand <david@redhat.com> To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-rdma@vger.kernel.org, linux-media@vger.kernel.org, linux-kselftest@vger.kernel.org, David Hildenbrand <david@redhat.com>, Linus Torvalds <torvalds@linux-foundation.org>, Andrew Morton <akpm@linux-foundation.org>, Jason Gunthorpe <jgg@ziepe.ca>, John Hubbard <jhubbard@nvidia.com>, Peter Xu <peterx@redhat.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Andrea Arcangeli <aarcange@redhat.com>, Hugh Dickins <hughd@google.com>, Nadav Amit <namit@vmware.com>, Vlastimil Babka <vbabka@suse.cz>, Matthew Wilcox <willy@infradead.org>, Mike Kravetz <mike.kravetz@oracle.com>, Muchun Song <songmuchun@bytedance.com>, Lucas Stach <l.stach@pengutronix.de>, David Airlie <airlied@gmail.com>, Oded Gabbay <ogabbay@kernel.org>, Arnd Bergmann <arnd@arndb.de>, Leon Romanovsky <leon@kernel.org> Subject: [PATCH RFC 10/19] RDMA/umem: remove FOLL_FORCE usage Date: Mon, 7 Nov 2022 17:17:31 +0100 Message-Id: <20221107161740.144456-11-david@redhat.com> In-Reply-To: <20221107161740.144456-1-david@redhat.com> References: <20221107161740.144456-1-david@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748855091170388566?= X-GMAIL-MSGID: =?utf-8?q?1748855091170388566?= |
Series |
mm/gup: remove FOLL_FORCE usage from drivers (reliable R/O long-term pinning)
|
|
Commit Message
David Hildenbrand
Nov. 7, 2022, 4:17 p.m. UTC
GUP now supports reliable R/O long-term pinning in COW mappings, such
that we break COW early. MAP_SHARED VMAs only use the shared zeropage so
far in one corner case (DAXFS file with holes), which can be ignored
because GUP does not support long-term pinning in fsdax (see
check_vma_flags()).
Consequently, FOLL_FORCE | FOLL_WRITE | FOLL_LONGTERM is no longer required
for reliable R/O long-term pinning: FOLL_LONGTERM is sufficient. So stop
using FOLL_FORCE, which is really only for debugger access.
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Leon Romanovsky <leon@kernel.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
drivers/infiniband/core/umem.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
Comments
On Mon, Nov 07, 2022 at 05:17:31PM +0100, David Hildenbrand wrote: > GUP now supports reliable R/O long-term pinning in COW mappings, such > that we break COW early. MAP_SHARED VMAs only use the shared zeropage so > far in one corner case (DAXFS file with holes), which can be ignored > because GUP does not support long-term pinning in fsdax (see > check_vma_flags()). > > Consequently, FOLL_FORCE | FOLL_WRITE | FOLL_LONGTERM is no longer required > for reliable R/O long-term pinning: FOLL_LONGTERM is sufficient. So stop > using FOLL_FORCE, which is really only for debugger access. > > Cc: Jason Gunthorpe <jgg@ziepe.ca> > Cc: Leon Romanovsky <leon@kernel.org> > Signed-off-by: David Hildenbrand <david@redhat.com> > --- > drivers/infiniband/core/umem.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) Thanks, Tested-by: Leon Romanovsky <leonro@nvidia.com> # Over mlx4 and mlx5.
diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c index 86d479772fbc..755a9c57db6f 100644 --- a/drivers/infiniband/core/umem.c +++ b/drivers/infiniband/core/umem.c @@ -156,7 +156,7 @@ struct ib_umem *ib_umem_get(struct ib_device *device, unsigned long addr, struct mm_struct *mm; unsigned long npages; int pinned, ret; - unsigned int gup_flags = FOLL_WRITE; + unsigned int gup_flags = FOLL_LONGTERM; /* * If the combination of the addr and size requested for this memory @@ -210,8 +210,8 @@ struct ib_umem *ib_umem_get(struct ib_device *device, unsigned long addr, cur_base = addr & PAGE_MASK; - if (!umem->writable) - gup_flags |= FOLL_FORCE; + if (umem->writable) + gup_flags |= FOLL_WRITE; while (npages) { cond_resched(); @@ -219,7 +219,7 @@ struct ib_umem *ib_umem_get(struct ib_device *device, unsigned long addr, min_t(unsigned long, npages, PAGE_SIZE / sizeof(struct page *)), - gup_flags | FOLL_LONGTERM, page_list); + gup_flags, page_list); if (pinned < 0) { ret = pinned; goto umem_release;