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 EB97FC47095 for ; Wed, 7 Oct 2020 17:33:28 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 502C52168B for ; Wed, 7 Oct 2020 17:33:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="I7/owwaB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 502C52168B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 545E06B0070; Wed, 7 Oct 2020 13:33:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4F7C16B0071; Wed, 7 Oct 2020 13:33:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3BE9B6B0072; Wed, 7 Oct 2020 13:33:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0201.hostedemail.com [216.40.44.201]) by kanga.kvack.org (Postfix) with ESMTP id 0E3206B0070 for ; Wed, 7 Oct 2020 13:33:27 -0400 (EDT) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 9FE62362A for ; Wed, 7 Oct 2020 17:33:26 +0000 (UTC) X-FDA: 77345826012.14.cork22_2b0c1ae271d1 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin14.hostedemail.com (Postfix) with ESMTP id 78A601822987B for ; Wed, 7 Oct 2020 17:33:26 +0000 (UTC) X-HE-Tag: cork22_2b0c1ae271d1 X-Filterd-Recvd-Size: 5627 Received: from mail-qv1-f68.google.com (mail-qv1-f68.google.com [209.85.219.68]) by imf02.hostedemail.com (Postfix) with ESMTP for ; Wed, 7 Oct 2020 17:33:25 +0000 (UTC) Received: by mail-qv1-f68.google.com with SMTP id b19so1614264qvm.6 for ; Wed, 07 Oct 2020 10:33:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=TdSre1+FiF17b2WS+AUXMuyymNAaLTf4uLT17E+pnFU=; b=I7/owwaByfC+T615S4yoAl1o98d1ue1FvXLjxM8yebhh+9JecaDPgFNy3dbnkmB8TN Vzx15ySYhGig+ha8DgJwv0JB9nc9mTmHX7s01XzVMtrzGqF7F5ysx9nVT6a95aQv8luf ubR2OEMsVZaWQ7RmDyyDSLyoP0q7IOFEADlrOkM8v9xk0+G5fAvCgdRAbNUwL2HYX/wg NdxL0Agtty3FgSPu+bQMrdJNei+OMp8ipKgGOhWKyjOjRZlk7D/1NKUJUn0ab2X75jIZ GLdNE/c4Zf4maicgzgeRTMpXMrGmFUZrqUFukx9r5Pv+87LO5DNFvo/M0m7x2mbqppxs Yd4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=TdSre1+FiF17b2WS+AUXMuyymNAaLTf4uLT17E+pnFU=; b=TKoyhFlqJx0d4aVnL0kIn52haFCgPrfWR8oqPWTsUYqKhjrvtDYRnRKGz5drb6GLgk d89/lc1zpyd6irNqkkRn2dCOdSaNG4o3byVcjR5lPSXaanSpCW1xodT/hXiJGFqLwCpF jxo0KvIK+GG3Bmi/raynK5zctz7F+4MuX8+irOAMuC3U7POEnVhg5X4slf217ca8fYdZ UYog2i22AmzJj/pD34QojU3ZsCV/8x/gDL/UkoDUpS9QmagjBZSUvN94xoexwVRmGF3e qQS2llfqpr8W5cAzTSEwjy9/kEN8Fwp/jeCBt1CwY3YUemD3/ISNkVL22/0puf53QeNv UQTQ== X-Gm-Message-State: AOAM531Xu27mjAVkcNI8612Ru8fP2p7f0epmGJKn2cqCRxWvsRvhPYHh Lc5SdROHx1mRpUWydOgLQ4ugbA== X-Google-Smtp-Source: ABdhPJw0qC4HxiG6+lNGoLhXdKRQ6phNXWeAziKb0zM4HKIClbwU3fAgBb5ZP6iA8tkK3T/vsUzqKA== X-Received: by 2002:ad4:456c:: with SMTP id o12mr4490006qvu.48.1602092005183; Wed, 07 Oct 2020 10:33:25 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-48-30.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.48.30]) by smtp.gmail.com with ESMTPSA id 184sm1954180qkl.104.2020.10.07.10.33.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Oct 2020 10:33:24 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1kQDJb-0010xU-S5; Wed, 07 Oct 2020 14:33:23 -0300 Date: Wed, 7 Oct 2020 14:33:23 -0300 From: Jason Gunthorpe To: Daniel Vetter 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?SsOpcsO0bWU=?= Glisse , Jan Kara , Dan Williams Subject: Re: [PATCH 05/13] mm/frame-vector: Use FOLL_LONGTERM Message-ID: <20201007173323.GV5177@ziepe.ca> References: <20201007164426.1812530-1-daniel.vetter@ffwll.ch> <20201007164426.1812530-6-daniel.vetter@ffwll.ch> <20201007165316.GT5177@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 07, 2020 at 07:12:24PM +0200, Daniel Vetter wrote: > 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. It does read very poorly with the redundant check, espeically since I keep forgetting follow_pfn does it too :\ Jason