Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2050763imm; Sat, 29 Sep 2018 09:22:01 -0700 (PDT) X-Google-Smtp-Source: ACcGV61P7C1TzS9t5zm+0iERJAlWfxC9SO17UjDiya2/jJK2RPYtqUpxU1DPfF/aWNY+gmGzAEZh X-Received: by 2002:a62:4ec9:: with SMTP id c192-v6mr3714155pfb.221.1538238121314; Sat, 29 Sep 2018 09:22:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538238121; cv=none; d=google.com; s=arc-20160816; b=tjubjq19kUvnQcpgIBFSnW9hUPKnssBebZoAa7EBpELL0ASJn38zGWKEv4PUvpidWR 1cHtxOpB5hZ+e1jZp1DNhJ8O5snHMea56VOG1+QpfMq95DYpG6uswwlesF4txDWDopdq 19uqQ4vvRs3xsBnNFWMO4EBHoh0VsjhMRjrIcYjrpEeuO5iKwccjrtekfDjLElC0ouy3 Lq1ZmSrL+ogbBj4bHQySAZjRUmPUHKeM7t7w2jxENwE6AYehvceyJHoRbR2z+41CT6AN 8IY/P0kW5MdonccrIVYP+FnM/TWXzk/S9/Bzg7mU/r57D3UhzhfpwmoMkiqaTbX9/0Jk 9iFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=yGnfntiwPmkgio20ndFB4H/cD3o8VkBmIPFP56KX+A0=; b=LoEJ8Pv4OYoB0n38W7amjsr5sF8z2cqC/62ur7BfLSeaJei68YfiPvShBv3vA+muHO qTsrs13RY8PF1ETux40+5kbIJWal/x2VOO+457xU3LQc1ArTSXlRu0BXe5ZYzG9QRSsE AfO/vcYJS0VF4RevMXh+xdSHqnvcr9bXoIAFRGq2W1A9uXbjC4Vvkpv41LaTOy3v/izF MffQrRE8+h85++pu/H9vagkaKBNNsnj3wlIcfrRyOv9UbtSsoboWByNk6uCbt6k24Mkz OKp524+6AvNF9p8uVS3HJ7Ch1VYu7wE9bFmyVGU9Q7gsXegTFtwkwUo5tETDVDFb6xxl 1a9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=UBW2jjaD; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p20-v6si7466972pgm.192.2018.09.29.09.21.32; Sat, 29 Sep 2018 09:22:01 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=UBW2jjaD; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728406AbeI2Wu2 (ORCPT + 99 others); Sat, 29 Sep 2018 18:50:28 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:48894 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728123AbeI2Wu2 (ORCPT ); Sat, 29 Sep 2018 18:50:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=yGnfntiwPmkgio20ndFB4H/cD3o8VkBmIPFP56KX+A0=; b=UBW2jjaDjceelrkLQ55ezP/Yb Gkf2s6sz6swBU1m6WKG7fQrBneboc2jpiAdrqx9AkXkop61IPmhjoNzsBix1is+e/gzBqf/AuvdZT PZrQolwzF7dLkZ8n0ei6KZGOMMXmVh6GNU5Ylabk6xcbRhzQiVgOxlyUkdB8V4kwM+icWc5sSEJZk YC+/t6f6vWpbd5cIskuuHfs0pB0VCAxsOFs6oObLdzwzR3eRbmeNcXRtwiqScnhwOVAar2jGzpE4H zFIC6t3wjN9CVmNrGshCm/mk68SXk3ORXrayVnaTAiguMTuC9miwsw1rCd0ivQbXVBfMy2opj4GDm Kn2RdCzNw==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1g6HzZ-0002bu-CA; Sat, 29 Sep 2018 16:21:17 +0000 Date: Sat, 29 Sep 2018 09:21:17 -0700 From: Matthew Wilcox To: John Hubbard Cc: Jason Gunthorpe , john.hubbard@gmail.com, Michal Hocko , Christopher Lameter , Dan Williams , Jan Kara , Al Viro , linux-mm@kvack.org, LKML , linux-rdma , linux-fsdevel@vger.kernel.org, Doug Ledford , Mike Marciniszyn , Dennis Dalessandro , Christian Benvenuti Subject: Re: [PATCH 3/4] infiniband/mm: convert to the new put_user_page() call Message-ID: <20180929162117.GA31216@bombadil.infradead.org> References: <20180928053949.5381-1-jhubbard@nvidia.com> <20180928053949.5381-3-jhubbard@nvidia.com> <20180928153922.GA17076@ziepe.ca> <36bc65a3-8c2a-87df-44fc-89a1891b86db@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <36bc65a3-8c2a-87df-44fc-89a1891b86db@nvidia.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 28, 2018 at 08:12:33PM -0700, John Hubbard wrote: > >> +++ b/drivers/infiniband/core/umem.c > >> @@ -60,7 +60,7 @@ static void __ib_umem_release(struct ib_device *dev, struct ib_umem *umem, int d > >> page = sg_page(sg); > >> if (!PageDirty(page) && umem->writable && dirty) > >> set_page_dirty_lock(page); > >> - put_page(page); > >> + put_user_page(page); > > > > Would it make sense to have a release/put_user_pages_dirtied to absorb > > the set_page_dity pattern too? I notice in this patch there is some > > variety here, I wonder what is the right way? > > > > Also, I'm told this code here is a big performance bottleneck when the > > number of pages becomes very long (think >> GB of memory), so having a > > future path to use some kind of batching/threading sound great. > > Yes. And you asked for this the first time, too. Consistent! :) Sorry for > being slow to pick it up. It looks like there are several patterns, and > we have to support both set_page_dirty() and set_page_dirty_lock(). So > the best combination looks to be adding a few variations of > release_user_pages*(), but leaving put_user_page() alone, because it's > the "do it yourself" basic one. Scatter-gather will be stuck with that. I think our current interfaces are wrong. We should really have a get_user_sg() / put_user_sg() function that will set up / destroy an SG list appropriate for that range of user memory. This is almost orthogonal to the original intent here, so please don't see this as a "must do first" kind of argument that might derail the whole thing.