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=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 81002C7618F for ; Tue, 23 Jul 2019 00:25:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5C8C621955 for ; Tue, 23 Jul 2019 00:25:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728481AbfGWAZh (ORCPT ); Mon, 22 Jul 2019 20:25:37 -0400 Received: from mga04.intel.com ([192.55.52.120]:52276 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727627AbfGWAZh (ORCPT ); Mon, 22 Jul 2019 20:25:37 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Jul 2019 17:25:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,297,1559545200"; d="scan'208";a="180568074" Received: from iweiny-desk2.sc.intel.com ([10.3.52.157]) by orsmga002.jf.intel.com with ESMTP; 22 Jul 2019 17:25:34 -0700 Date: Mon, 22 Jul 2019 17:25:34 -0700 From: Ira Weiny To: john.hubbard@gmail.com Cc: Andrew Morton , Alexander Viro , =?iso-8859-1?Q?Bj=F6rn_T=F6pel?= , Boaz Harrosh , Christoph Hellwig , Daniel Vetter , Dan Williams , Dave Chinner , David Airlie , "David S . Miller" , Ilya Dryomov , Jan Kara , Jason Gunthorpe , Jens Axboe , =?iso-8859-1?B?Suly9G1l?= Glisse , Johannes Thumshirn , Magnus Karlsson , Matthew Wilcox , Miklos Szeredi , Ming Lei , Sage Weil , Santosh Shilimkar , Yan Zheng , netdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mm@kvack.org, linux-rdma@vger.kernel.org, bpf@vger.kernel.org, LKML , John Hubbard Subject: Re: [PATCH 3/3] net/xdp: convert put_page() to put_user_page*() Message-ID: <20190723002534.GA10284@iweiny-DESK2.sc.intel.com> References: <20190722223415.13269-1-jhubbard@nvidia.com> <20190722223415.13269-4-jhubbard@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190722223415.13269-4-jhubbard@nvidia.com> User-Agent: Mutt/1.11.1 (2018-12-01) Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org 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örn Töpel > 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) > > static void xdp_umem_unpin_pages(struct xdp_umem *umem) > { > - unsigned int i; > - > - for (i = 0; i < umem->npgs; i++) { > - struct page *page = umem->pgs[i]; > - > - set_page_dirty_lock(page); > - put_page(page); > - } > + put_user_pages_dirty_lock(umem->pgs, umem->npgs); What is the difference between this and __put_user_pages(umem->pgs, umem->npgs, PUP_FLAGS_DIRTY_LOCK); ? I'm a bit concerned with adding another form of the same interface. We should either have 1 call with flags (enum in this case) or multiple calls. Given the previous discussion lets move in the direction of having the enum but don't introduce another caller of the "old" interface. So I think on this patch NAK from me. I also don't like having a __* call in the exported interface but there is a __get_user_pages_fast() call so I guess there is precedent. :-/ Ira > > kfree(umem->pgs); > umem->pgs = NULL; > -- > 2.22.0 >