From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68723C4741F for ; Wed, 7 Oct 2020 17:12:39 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DCDEF21789 for ; Wed, 7 Oct 2020 17:12:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="XywxnLHw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DCDEF21789 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1F85B6B0068; Wed, 7 Oct 2020 13:12:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 182516B006C; Wed, 7 Oct 2020 13:12:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 04B036B006E; Wed, 7 Oct 2020 13:12:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0112.hostedemail.com [216.40.44.112]) by kanga.kvack.org (Postfix) with ESMTP id C91B06B0068 for ; Wed, 7 Oct 2020 13:12:37 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 562E91EE6 for ; Wed, 7 Oct 2020 17:12:37 +0000 (UTC) X-FDA: 77345773554.08.hand29_37054e0271d1 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin08.hostedemail.com (Postfix) with ESMTP id 23D961819E798 for ; Wed, 7 Oct 2020 17:12:37 +0000 (UTC) X-HE-Tag: hand29_37054e0271d1 X-Filterd-Recvd-Size: 4718 Received: from mail-ot1-f65.google.com (mail-ot1-f65.google.com [209.85.210.65]) by imf08.hostedemail.com (Postfix) with ESMTP for ; Wed, 7 Oct 2020 17:12:36 +0000 (UTC) Received: by mail-ot1-f65.google.com with SMTP id l4so2918052ota.7 for ; Wed, 07 Oct 2020 10:12:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ds2b6pt8mpuSnK1WqusZcK5IPcMpzyRXiJsNhW5qyYM=; b=XywxnLHwupjUJptE/EVD6sBBvmwp1LZdLWVQN7sGbbfMYl92hBOlZr7ZFS4X+E/amg opzvB15wo+wkKlQcyzXYRqNCcc6ZTwDvf0ncSkJzjaY9dJ7cef2oaD3bBKharNZqlUDk SK2SYwy12YuTYhWzjRrLHd7+bMmqCT/EcoV/4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ds2b6pt8mpuSnK1WqusZcK5IPcMpzyRXiJsNhW5qyYM=; b=bGvbFIijApKnhuAwHIWx1o/lf8i2knbA5UsxQ37UHcqEaPl6bZhf2Ar8FAnF5Q/0mw 7a9DGCS3pRfi8sSKO13s7ERphN3UlPUxDloHo/yV4HWV6/oNFJTxc8BnL/+6/RT1NUUQ WV5uWS0K6iwzubqcIXNwtD4EnOnnz83EUpFxv7czHLM0S/oLKKLMaDAGGldZ3zOuNRS2 CdiqcxPZBJfiiuPL+ke3N2FsPtyKqKUdSKB1zIkiMCIB/rI6myGPQL9KDDOCaBe+h1ww 3g+FVjpwqUKBGb6DkYWZy1rtQPvXN6Jg0K24PJk2Ye0P+z/e4l5ZkPef124nXiWiYNIm JoXw== X-Gm-Message-State: AOAM532G5PJuIj+krk7Mumoh7gm/pN4QanI/SqOJMoRnSeDEZcviIOih 4TtiwYevwYxtLmr+ScyYP3igL/zmgZZmypwzUOHG4w== X-Google-Smtp-Source: ABdhPJzTO+z2ObbheXgto8t7rJhDCsKMuOtKVLpylgXo93WqdqDznkfE8ic3+XhZYxCrctCNbkyO32BPlJ+tqH+Wfoo= X-Received: by 2002:a05:6830:1c3c:: with SMTP id f28mr2639345ote.188.1602090755973; Wed, 07 Oct 2020 10:12:35 -0700 (PDT) MIME-Version: 1.0 References: <20201007164426.1812530-1-daniel.vetter@ffwll.ch> <20201007164426.1812530-6-daniel.vetter@ffwll.ch> <20201007165316.GT5177@ziepe.ca> In-Reply-To: <20201007165316.GT5177@ziepe.ca> From: Daniel Vetter Date: Wed, 7 Oct 2020 19:12:24 +0200 Message-ID: Subject: Re: [PATCH 05/13] mm/frame-vector: Use FOLL_LONGTERM To: Jason Gunthorpe Cc: DRI Development , LKML , kvm@vger.kernel.org, Linux MM , Linux ARM , linux-samsung-soc , "open list:DMA BUFFER SHARING FRAMEWORK" , linux-s390@vger.kernel.org, Daniel Vetter , Pawel Osciak , Marek Szyprowski , Kyungmin Park , Tomasz Figa , Mauro Carvalho Chehab , Andrew Morton , John Hubbard , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Jan Kara , Dan Williams Content-Type: text/plain; charset="UTF-8" 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: On Wed, Oct 7, 2020 at 6:53 PM Jason Gunthorpe wrote: > > On Wed, Oct 07, 2020 at 06:44:18PM +0200, Daniel Vetter wrote: > > > > - /* > > - * While get_vaddr_frames() could be used for transient (kernel > > - * controlled lifetime) pinning of memory pages all current > > - * users establish long term (userspace controlled lifetime) > > - * page pinning. Treat get_vaddr_frames() like > > - * get_user_pages_longterm() and disallow it for filesystem-dax > > - * mappings. > > - */ > > - if (vma_is_fsdax(vma)) { > > - ret = -EOPNOTSUPP; > > - goto out; > > - } > > - > > - if (!(vma->vm_flags & (VM_IO | VM_PFNMAP))) { > > - vec->got_ref = true; > > - vec->is_pfns = false; > > - ret = pin_user_pages_locked(start, nr_frames, > > - gup_flags, (struct page **)(vec->ptrs), &locked); > > - goto out; > > - } > > The vm_flags still need to be checked before going into the while > loop. If the break is taken then nothing would check vm_flags Hm right that's a bin inconsistent. follow_pfn also checks for this, so I think we can just ditch this entirely both here and in the do {} while () check, simplifying the latter to just while (vma). Well, just make it a real loop with less confusing control flow probably. Or prefer I keep this and touch the code less? -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch