From patchwork Thu Apr 11 21:08:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jerome Glisse X-Patchwork-Id: 10896815 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BF8401708 for ; Thu, 11 Apr 2019 21:08:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A73DC28DF5 for ; Thu, 11 Apr 2019 21:08:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9AA1528DF8; Thu, 11 Apr 2019 21:08:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C5C1028DF6 for ; Thu, 11 Apr 2019 21:08:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 28DB56B026B; Thu, 11 Apr 2019 17:08:50 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 218646B026C; Thu, 11 Apr 2019 17:08:50 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0BC2C6B026D; Thu, 11 Apr 2019 17:08:49 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by kanga.kvack.org (Postfix) with ESMTP id D41266B026B for ; Thu, 11 Apr 2019 17:08:49 -0400 (EDT) Received: by mail-qk1-f198.google.com with SMTP id g25so6168933qkm.22 for ; Thu, 11 Apr 2019 14:08:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=7Ca7Z8NG5OMgg4MbdGL4h958yxZA80rzhHRQRgRbXrM=; b=hwCvUaeljYq2BX4U53UkU8cQL4iHYQD6Qn1LUYOo6SnGHtiWGNsYhFD2uEoGCyrFDL zAfDFOcTAdMpisKCprSpvywKGU6djkyHCGoVPVBI6etyyyCKKW1Ux3UXCLQcSzQmMlrT KHQe/U7SbPQ1eS7JfwIbar/jfR483bSdv5Z6WWg/yCKAC85skJTOLMeGWbSDPxD//8GA thmFXcVHrRjVqRwiXsRFg1lABx81OqacB23k22B/4gse/i0N5EjU2UdpmjNnAr5EuM0D QhiZ2e3tOAszddweTLCdN+jjfuDPmbddAV2LFdjTT70I2SvkkzpHiVW5TwXLAGTy5j0f 28OQ== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of jglisse@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=jglisse@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Gm-Message-State: APjAAAUCXyfdNYXECV+AQZ4lex5UslkDYAjgyX4ozICsJux/4cNXSAjL HlaE9fb+uIFW3g6kfijLxo6NOLfF3am4raDOHdthFhDSTD6KlNpl+pUARLct6sC+r3ntLgW7prw M4dux655UrColYKJMMW8p6NDnMJNBM1UKnwCaeaI45mRWzKREh1xHcdLIAWTXVV/3XQ== X-Received: by 2002:ac8:30ea:: with SMTP id w39mr44240917qta.351.1555016929594; Thu, 11 Apr 2019 14:08:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqz6Ad2h1xz9pNa8yrrzePgNYqlOk3B1AFqJ2TCEfAwsKy8t3tPEwBIocIBlezM3+cbvMrLv X-Received: by 2002:ac8:30ea:: with SMTP id w39mr44240840qta.351.1555016928644; Thu, 11 Apr 2019 14:08:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555016928; cv=none; d=google.com; s=arc-20160816; b=uarwICkayo3JSLA9YLF+bTOQRDrVrVhS7xUkiytZx0bYiXdrrW4l2AQIkH2AjnrImQ bocf3aVXFzaasO9y2H92NqHAbo0CMS599nr8C0QfkgST9Sx9pWcFmhlQ/j8QQhKAhl01 iH5vx2XytkHZdZ2JCzzfhRXKLgGDMger4/UwyaJQ9H0A710+3eyNseXmtGHidkqAOJJo 4ceJR7Jbhn8FoCom1Tv2x9wDCOF18E+aETZ9gvZmahOrvD2UP8566jobghCoQIzB38KV yvrzRQk8BmyVdCORuQU0UA5nEwEXWO2AlgLP9r31etVW2yyc/pCTK4i/UOzoxxMLamyB hJXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=7Ca7Z8NG5OMgg4MbdGL4h958yxZA80rzhHRQRgRbXrM=; b=IrwhSXdLj4dCOHvlrFvV+5QsY6ixv9wU6bijQUinW3l3Fl/uOmm+WNCWcYnNXyHprm 8Qyv5zpeiDI1FIPybu8G2aYGCze4uZN8NWjdHNclKRef18LceseOkoGwffacm4FybDeI CQJtpc1gkXPeqjrFpU/Fpea9lm8yZJGTBLmGH1zbku5D2dBWW1P9qme+TAWlzhSwh2ko wNY+M5rjYzZT24a+ActhawtdcnVs8hGF+vau927V+OFvK/jxvvhk/wD5itmk4zSKcusj RPdL6ZyxYf0FpoyEoaPzCqeBeptWYRGkxkjX21E9UIUMTQtQDCyjq2lE+bEkUbf2k4w2 fdpw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of jglisse@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=jglisse@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id i33si2138482qvd.144.2019.04.11.14.08.48 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Apr 2019 14:08:48 -0700 (PDT) Received-SPF: pass (google.com: domain of jglisse@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of jglisse@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=jglisse@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BBE38368E6; Thu, 11 Apr 2019 21:08:47 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.20.6.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id 492F15C21E; Thu, 11 Apr 2019 21:08:46 +0000 (UTC) From: jglisse@redhat.com To: linux-kernel@vger.kernel.org Cc: =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-mm@kvack.org, John Hubbard , Jan Kara , Dan Williams , Alexander Viro , Johannes Thumshirn , Christoph Hellwig , Jens Axboe , Ming Lei , Dave Chinner , Jason Gunthorpe , Matthew Wilcox Subject: [PATCH v1 02/15] iov_iter: add helper to test if an iter would use GUP Date: Thu, 11 Apr 2019 17:08:21 -0400 Message-Id: <20190411210834.4105-3-jglisse@redhat.com> In-Reply-To: <20190411210834.4105-1-jglisse@redhat.com> References: <20190411210834.4105-1-jglisse@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 11 Apr 2019 21:08:48 +0000 (UTC) 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: X-Virus-Scanned: ClamAV using ClamSMTP From: Jérôme Glisse Add an helper to test if call to iov_iter_get_pages*() with a given iter would result in calls to GUP (get_user_pages*()). We want to track differently page reference if they are coming from GUP and thus we need to know when GUP is use for a given iter. Signed-off-by: Jérôme Glisse Cc: linux-fsdevel@vger.kernel.org Cc: linux-block@vger.kernel.org Cc: linux-mm@kvack.org Cc: John Hubbard Cc: Jan Kara Cc: Dan Williams Cc: Alexander Viro Cc: Johannes Thumshirn Cc: Christoph Hellwig Cc: Jens Axboe Cc: Ming Lei Cc: Dave Chinner Cc: Jason Gunthorpe Cc: Matthew Wilcox --- include/linux/uio.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/linux/uio.h b/include/linux/uio.h index f184af1999a8..b12b2878a266 100644 --- a/include/linux/uio.h +++ b/include/linux/uio.h @@ -98,6 +98,17 @@ static inline bool iov_iter_bvec_no_ref(const struct iov_iter *i) return (i->type & ITER_BVEC_FLAG_NO_REF) != 0; } +/** + * iov_iter_get_pages_use_gup - true if iov_iter_get_pages(i) use GUP + * @i: iter + * Returns: true if a call to iov_iter_get_pages*() with the iter provided in + * argument would result in the use of get_user_pages*() + */ +static inline bool iov_iter_get_pages_use_gup(const struct iov_iter *i) +{ + return iov_iter_type(i) & (ITER_IOVEC | ITER_PIPE); +} + /* * Total number of bytes covered by an iovec. *