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=-5.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 460AFC04E30 for ; Mon, 9 Dec 2019 18:25:43 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0A15720836 for ; Mon, 9 Dec 2019 18:25:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="u+Pyb/iD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0A15720836 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id AD1176B280B; Mon, 9 Dec 2019 13:25:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AA8766B280D; Mon, 9 Dec 2019 13:25:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9E6306B280E; Mon, 9 Dec 2019 13:25:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0129.hostedemail.com [216.40.44.129]) by kanga.kvack.org (Postfix) with ESMTP id 898186B280B for ; Mon, 9 Dec 2019 13:25:42 -0500 (EST) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id 19C0E52BF for ; Mon, 9 Dec 2019 18:25:42 +0000 (UTC) X-FDA: 76246431324.26.tub01_890cd80e9192d X-HE-Tag: tub01_890cd80e9192d X-Filterd-Recvd-Size: 2668 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf43.hostedemail.com (Postfix) with ESMTP for ; Mon, 9 Dec 2019 18:25:41 +0000 (UTC) Received: from localhost (unknown [5.29.147.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0D1962077B; Mon, 9 Dec 2019 18:25:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575915940; bh=7lZhBALm50HN15SBV5fFrjzT8kipUFrgnVFKe9+PyI0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=u+Pyb/iDy+kPaQAzVaYes4E8svDMq84BeCg+ARHzAIP9AimybpRCbpl3GIhqqlnhb nHRW6EL6Sj0en0v8UklM/YoDdwplAkX2ZB3da/fTEuX4GNNfaXoyoJUg2ngdGv5VyV IcQcqp+sgvQ1CkUy50V7aC6F8twkZajXYu2URhMs= Date: Mon, 9 Dec 2019 20:25:36 +0200 From: Leon Romanovsky To: John Hubbard Cc: Andrew Morton , Jason Gunthorpe , Christoph Hellwig , Ira Weiny , linux-rdma@vger.kernel.org, linux-mm@kvack.org, LKML , Christoph Hellwig Subject: Re: [PATCH v2 1/2] mm/gup: allow FOLL_FORCE for get_user_pages_fast() Message-ID: <20191209182536.GC67461@unreal> References: <20191204213603.464373-1-jhubbard@nvidia.com> <20191204213603.464373-2-jhubbard@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191204213603.464373-2-jhubbard@nvidia.com> User-Agent: Mutt/1.12.1 (2019-06-15) 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, Dec 04, 2019 at 01:36:02PM -0800, John Hubbard wrote: > Commit 817be129e6f2 ("mm: validate get_user_pages_fast flags") allowed > only FOLL_WRITE and FOLL_LONGTERM to be passed to get_user_pages_fast(). > This, combined with the fact that get_user_pages_fast() falls back to > "slow gup", which *does* accept FOLL_FORCE, leads to an odd situation: > if you need FOLL_FORCE, you cannot call get_user_pages_fast(). > > There does not appear to be any reason for filtering out FOLL_FORCE. > There is nothing in the _fast() implementation that requires that we > avoid writing to the pages. So it appears to have been an oversight. > > Fix by allowing FOLL_FORCE to be set for get_user_pages_fast(). > > Fixes: 817be129e6f2 ("mm: validate get_user_pages_fast flags") > Cc: Christoph Hellwig > Signed-off-by: John Hubbard > --- > mm/gup.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > Thanks, Reviewed-by: Leon Romanovsky