Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp8274254ybi; Tue, 23 Jul 2019 05:53:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqz59XndKLi+8X/emQBoqfY8dDhtsss+sfTAD7Dp2IOXR4THv0X5t2QlfsBDwD6vtLESljkr X-Received: by 2002:a17:90a:d14b:: with SMTP id t11mr82210777pjw.79.1563886426161; Tue, 23 Jul 2019 05:53:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563886426; cv=none; d=google.com; s=arc-20160816; b=lBGzZXCUtFXF/UVudGYms369Ve4HjNgU9eCjZAPOZ5CLdew/o64vg8rnwlsGyYPMIb 7YmDPxAV9MNWbQtW8SaNP45UOoRrDXlW8XUdp27TI6b12urjAMIVdbSAUxFc0QXqdah1 pIovIEIgZ4YoF7MLloIjyqA4fdrZtNj04fgQVhkgnOKY9iA4HUCLnXevVx14t3o1j4mo X1hrOLjM5px1M6jIWDQzdNhXg43OoGSKlnphJnA4vfHWFIuJbqE5LLpftncoNCnLFff7 eg8ZQvcL4Z7yB7u3HL9bQPPdti9vou4aFU04xr8fHE549hDFOogVtGzjoZkdfRnBiXds 2hEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=6Lt/z2MUaW0HLuGN6nPZXpx+R7NECtbBk4FafHzD+OU=; b=dStZv3Y5LnT8kCHPLasykfEhdOkBCu32aQruj6g1+BaC55MSmM0dLs8Xalv1wj0+yY 9V0z2160YgP4wLsUwooxL+YIMTrJ7Ox36mq1TbBWkgRI3ofjfn3mqyeyz/PHentM0wHM wpyJRO+saacW4emiFb/sGukDxRSOd6EMqBovO1Ql+swXSyGeqQiq9u3l3HyU+g7U0qef 5u4vV/omllCFIYD8ZxCk6XE5tauPLOnF1sShP2W6KpDlQadVKWe3PtM0WBRPQ5b+tLfL efHLHglS8WsMrV0HXNkkkoajqfxi39HoKGNnLy+PHn42ckY7wVkvDFsym4PoCxSKzS9/ RhbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=Qa3lZLE8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c35si2559650pgm.51.2019.07.23.05.53.29; Tue, 23 Jul 2019 05:53:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=Qa3lZLE8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732584AbfGWEnF (ORCPT + 99 others); Tue, 23 Jul 2019 00:43:05 -0400 Received: from hqemgate14.nvidia.com ([216.228.121.143]:7889 "EHLO hqemgate14.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730761AbfGWEnE (ORCPT ); Tue, 23 Jul 2019 00:43:04 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate14.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 22 Jul 2019 21:43:02 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Mon, 22 Jul 2019 21:43:02 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Mon, 22 Jul 2019 21:43:02 -0700 Received: from [10.2.164.38] (172.20.13.39) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 23 Jul 2019 04:43:01 +0000 Subject: Re: [PATCH 3/3] net/xdp: convert put_page() to put_user_page*() To: Ira Weiny , CC: Andrew Morton , Alexander Viro , =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , Boaz Harrosh , Christoph Hellwig , Daniel Vetter , Dan Williams , Dave Chinner , David Airlie , "David S . Miller" , Ilya Dryomov , Jan Kara , Jason Gunthorpe , Jens Axboe , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Johannes Thumshirn , Magnus Karlsson , Matthew Wilcox , Miklos Szeredi , Ming Lei , Sage Weil , Santosh Shilimkar , Yan Zheng , , , , , , LKML References: <20190722223415.13269-1-jhubbard@nvidia.com> <20190722223415.13269-4-jhubbard@nvidia.com> <20190723002534.GA10284@iweiny-DESK2.sc.intel.com> From: John Hubbard X-Nvconfidentiality: public Message-ID: Date: Mon, 22 Jul 2019 21:41:34 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190723002534.GA10284@iweiny-DESK2.sc.intel.com> X-Originating-IP: [172.20.13.39] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1563856982; bh=6Lt/z2MUaW0HLuGN6nPZXpx+R7NECtbBk4FafHzD+OU=; h=X-PGP-Universal:Subject:To:CC:References:From:X-Nvconfidentiality: Message-ID:Date:User-Agent:MIME-Version:In-Reply-To: X-Originating-IP:X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=Qa3lZLE8Kf/RL8KhFgPo9Jkt7HFiKw1Is4rV87XoFGEKvWzwvIu+hxfTzr2uraY59 XErNMpPf1Qu2zCNLtYfVRqCa3/zsPozeqvDkM44qxxIpWE47R8YoLoPjAb9uunMk0+ 2+b5UcPkOzZtt+IdgVMrvpTMyr/Pdu3kowZiYCl3u00yAyQSmsitBmCoJle4OhJXpe bMuJ8grmilp9xNLC2hggYcxZ/uAvyWeQge9toK1cze9EOdK1UUkTm+VI05DdS87kNs cGOrzWdia2G/F74bOT0v75OXAOE8VdSB9dSxGpUKwW6BkxObVy2erx/jSiG+ZKKb1I 5O4vdoqzeZX4g== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/22/19 5:25 PM, Ira Weiny wrote: > On Mon, Jul 22, 2019 at 03:34:15PM -0700, john.hubbard@gmail.com wrote: >> From: John Hubbard >> >> For pages that were retained via get_user_pages*(), release those pages >> via the new put_user_page*() routines, instead of via put_page() or >> release_pages(). >> >> This is part a tree-wide conversion, as described in commit fc1d8e7cca2d >> ("mm: introduce put_user_page*(), placeholder versions"). >> >> Cc: Bj=C3=B6rn T=C3=B6pel >> Cc: Magnus Karlsson >> Cc: David S. Miller >> Cc: netdev@vger.kernel.org >> Signed-off-by: John Hubbard >> --- >> net/xdp/xdp_umem.c | 9 +-------- >> 1 file changed, 1 insertion(+), 8 deletions(-) >> >> diff --git a/net/xdp/xdp_umem.c b/net/xdp/xdp_umem.c >> index 83de74ca729a..0325a17915de 100644 >> --- a/net/xdp/xdp_umem.c >> +++ b/net/xdp/xdp_umem.c >> @@ -166,14 +166,7 @@ void xdp_umem_clear_dev(struct xdp_umem *umem) >> =20 >> static void xdp_umem_unpin_pages(struct xdp_umem *umem) >> { >> - unsigned int i; >> - >> - for (i =3D 0; i < umem->npgs; i++) { >> - struct page *page =3D umem->pgs[i]; >> - >> - set_page_dirty_lock(page); >> - put_page(page); >> - } >> + put_user_pages_dirty_lock(umem->pgs, umem->npgs); >=20 > What is the difference between this and >=20 > __put_user_pages(umem->pgs, umem->npgs, PUP_FLAGS_DIRTY_LOCK); >=20 > ? No difference. >=20 > I'm a bit concerned with adding another form of the same interface. We s= hould > either have 1 call with flags (enum in this case) or multiple calls. Giv= en the > previous discussion lets move in the direction of having the enum but don= 't > introduce another caller of the "old" interface. I disagree that this is a "problem". There is no maintenance pitfall here; = there are merely two ways to call the put_user_page*() API. Both are correct, and neither one will get you into trouble. Not only that, but there is ample precedent for this approach in other kernel APIs. >=20 > So I think on this patch NAK from me. >=20 > I also don't like having a __* call in the exported interface but there i= s a > __get_user_pages_fast() call so I guess there is precedent. :-/ >=20 I thought about this carefully, and looked at other APIs. And I noticed tha= t things like __get_user_pages*() are how it's often done: * The leading underscores are often used for the more elaborate form of the call (as oppposed to decorating the core function name with "_flags", for example). * There are often calls in which you can either call the simpler form, or t= he form with flags and additional options, and yes, you'll get the same result= . Obviously, this stuff is all subject to a certain amount of opinion, but I think I'm on really solid ground as far as precedent goes. So I'm pushing back on the NAK... :) thanks, --=20 John Hubbard NVIDIA