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 D282DC47095 for ; Wed, 7 Oct 2020 17:12:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 74F0921974 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" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727915AbgJGRMh (ORCPT ); Wed, 7 Oct 2020 13:12:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726707AbgJGRMg (ORCPT ); Wed, 7 Oct 2020 13:12:36 -0400 Received: from mail-ot1-x342.google.com (mail-ot1-x342.google.com [IPv6:2607:f8b0:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4168C0613D2 for ; Wed, 7 Oct 2020 10:12:36 -0700 (PDT) Received: by mail-ot1-x342.google.com with SMTP id s66so2955590otb.2 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=p+PtgMYuYFmgdHfZzD8LShY0k5E2SJb1PENURy78H/81nm3l95m5wBH6aQYgD/N9hj gJf5DPUppOd5CXFGnUqUShclCNcimkMLNz4QWbyOZ3YiIfIWgeMD5uPFDf4NhSPPa/UU 8rUwiT2V0wERlKJInoiWx3s1ek9h8uswJIRodnGKt77KeU2gKyZLWpam9orITOQsVlGV QGMMzPLUJAk9OvwsE+2zHNayZ+KRBb7LWaTBPjN267lLXsNuPXcT0titUrH7tqEN+O0q gMGLt7qLm1W7S0LeGeevHXVyJFDRnSGXfPi5eSA9XcDnnqlpGHOiAJclW+OWX/m/KOvX zeBg== X-Gm-Message-State: AOAM531XyAvEkRGHa+Iy6hN2EW0QDVtYcGEe5Ug2+t0Zaw7bzSNG4Dls 5lqo9aeW3NFWdxl3HUvRyViGGnSEQAPW0fbADsNLnQ== 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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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