Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp945372imm; Fri, 5 Oct 2018 14:50:07 -0700 (PDT) X-Google-Smtp-Source: ACcGV62PrUzXiabLPXlrRxls/KCshXpTrgDMg1xyg/h2/nFHJiqNT+OzL2hVex2kfUBktinPlwZb X-Received: by 2002:a17:902:9696:: with SMTP id n22-v6mr13486484plp.212.1538776207456; Fri, 05 Oct 2018 14:50:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538776207; cv=none; d=google.com; s=arc-20160816; b=kQa87QqKvfqyWtLlevrgLh8ZHUnjVB2G/PrM5dUei5kVg/BwwRLjg2DB3Z6GUyle/W jvx8nrKAT87N/044D8BzXHikJt6eAyPiqrReGXJ9psLXqq65ePzXnslMtEz4MltvVfhM 6ORSHUJkXg6xsmFGzQbY4mUp95yOaCpc2Gpluj3lqXPXN8EPd+SpV5KrIRgXZWixJisP OoIgvbXG+OO+Y8oGC2ku2w8yOJb3mXez8T+4m9XRnvH5VqCI6C9MrFUQMbUzpR8vmeU4 YqPRsV+pMvyoMBaqQeGXvih+b0LdF2tVYNjPdmQEclnXGGy6nVv+lZqUygFQj0g57thm ys8Q== 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=RmpIuzTYoCLJjlcKuFXKb3VkkcNBiZBingQdKG49O2U=; b=Dmr+sz/+71Wq9q69P9q5QTJkGb8Zegzf6SJcqX3vpeYYM0u8wclPVwRH5Bs2URT6jV 04oUn2WJDalHuz4MRUsFW03EpV0L/gB45LF7kmKqZUr4+yzfZjYiDaPz1R+bilEo8+7y Xw5PWiFcfkgejcxCCWpwwOx+MO0CD516xf6F5lB2qybVJmz1mYW9x0nS9k+M4nCKu3qe uZFnxfKf0FBJD8fd/fiTOCJeZYLvfX/nNRJC8SE82QIMELsXbuVyXaDafiuEezvsVGRw TyVm2PUxaezbpjfdxSQqfeaq/2I/i3kNKXOirtbjYd8CZ7jy2JetMYvjIBxpmSR5uXB5 ZnbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=KeBUucrv; 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 d41-v6si10065100pla.172.2018.10.05.14.49.52; Fri, 05 Oct 2018 14:50:07 -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=@ziepe.ca header.s=google header.b=KeBUucrv; 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 S1729056AbeJFEtI (ORCPT + 99 others); Sat, 6 Oct 2018 00:49:08 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:38461 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725787AbeJFEtI (ORCPT ); Sat, 6 Oct 2018 00:49:08 -0400 Received: by mail-pl1-f193.google.com with SMTP id b5-v6so7407284plr.5 for ; Fri, 05 Oct 2018 14:48:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=RmpIuzTYoCLJjlcKuFXKb3VkkcNBiZBingQdKG49O2U=; b=KeBUucrvIMPO1hFGRZgn+8VgPuVhEnRElgOzBYR/t91HM+6MGrFVSj0DSihFfukbKN JcQMEYmjzBDS/cNhKHzShQezYv/mdojZz50LsUx7evAJnjmA7Ov1ArP2ry/pdYeTEAz2 3UQe4c5vUzDmNmW82gebzhrj8C2ulZMzN8Qa+prif7x72p5YFsZX9fzQgDseco31wzqC tOrDPUJ+oaKE8xvNUuhBGx8u7eNsnZ5n4VAVcs64Gdf+zn+h3xaumJFBqwRSBCOV8nfJ SmphB5rQDzLESHJif5N+Akr2bbgns1uniclcbnXOFnOXmlXQCmWT9P31rqCY5/gowtb6 BXMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=RmpIuzTYoCLJjlcKuFXKb3VkkcNBiZBingQdKG49O2U=; b=EV97jII9dR7qj9JA7kY6iMeAA1zaWHnpo9orcQT9ry6ar1ythQBtdHrdHlArSnGwgO mpjYw36Flyyuz/LtKmFKNVPHP13rlU47RJz7EvVxQiovx0gnCEg7HmQE6NgA0STaZnuH bAXjuaaGaQm4NatpInd9FUAIMu/fHh7W6Ph2Lh3VEbrConoUvE4wRrkZGm9mf5c2/uhF 7as6exyUp/LEJqVPftYS/cmRYkXtr7J2/cRRUQsLQPaqS0w4v0hqvWQF0B/ss+AGZsKJ POd8ThcgC7RHz5iEA10Xg8ldQIctVKufXdEDjrQLckfihdaFdnG6gcHwQSqZAEgRqO/z sOxg== X-Gm-Message-State: ABuFfojG5Tbqd8QVj4AvwljXF/43TTqE6yok7wofCx0crf5oqCW373z3 Bt44AiyFPrjm33Gf80v4QLcC6g== X-Received: by 2002:a17:902:5a4d:: with SMTP id f13-v6mr13425633plm.114.1538776110327; Fri, 05 Oct 2018 14:48:30 -0700 (PDT) Received: from ziepe.ca (S010614cc2056d97f.ed.shawcable.net. [174.3.196.123]) by smtp.gmail.com with ESMTPSA id s13-v6sm13600379pfj.105.2018.10.05.14.48.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Oct 2018 14:48:27 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1g8XxS-0001Fx-HM; Fri, 05 Oct 2018 15:48:26 -0600 Date: Fri, 5 Oct 2018 15:48:26 -0600 From: Jason Gunthorpe To: John Hubbard Cc: john.hubbard@gmail.com, Matthew Wilcox , Michal Hocko , Christopher Lameter , Dan Williams , Jan Kara , linux-mm@kvack.org, LKML , linux-rdma , linux-fsdevel@vger.kernel.org, Al Viro , Jerome Glisse , Christoph Hellwig Subject: Re: [PATCH v2 2/3] mm: introduce put_user_page[s](), placeholder versions Message-ID: <20181005214826.GD20776@ziepe.ca> References: <20181005040225.14292-1-jhubbard@nvidia.com> <20181005040225.14292-3-jhubbard@nvidia.com> <20181005151726.GA20776@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 05, 2018 at 12:49:06PM -0700, John Hubbard wrote: > On 10/5/18 8:17 AM, Jason Gunthorpe wrote: > > On Thu, Oct 04, 2018 at 09:02:24PM -0700, john.hubbard@gmail.com wrote: > >> From: John Hubbard > >> > >> Introduces put_user_page(), which simply calls put_page(). > >> This provides a way to update all get_user_pages*() callers, > >> so that they call put_user_page(), instead of put_page(). > >> > >> Also introduces put_user_pages(), and a few dirty/locked variations, > >> as a replacement for release_pages(), for the same reasons. > >> These may be used for subsequent performance improvements, > >> via batching of pages to be released. > >> > >> This prepares for eventually fixing the problem described > >> in [1], and is following a plan listed in [2], [3], [4]. > >> > >> [1] https://lwn.net/Articles/753027/ : "The Trouble with get_user_pages()" > >> > >> [2] https://lkml.kernel.org/r/20180709080554.21931-1-jhubbard@nvidia.com > >> Proposed steps for fixing get_user_pages() + DMA problems. > >> > >> [3]https://lkml.kernel.org/r/20180710082100.mkdwngdv5kkrcz6n@quack2.suse.cz > >> Bounce buffers (otherwise [2] is not really viable). > >> > >> [4] https://lkml.kernel.org/r/20181003162115.GG24030@quack2.suse.cz > >> Follow-up discussions. > >> > [...] > >> > >> +/* Placeholder version, until all get_user_pages*() callers are updated. */ > >> +static inline void put_user_page(struct page *page) > >> +{ > >> + put_page(page); > >> +} > >> + > >> +/* For get_user_pages*()-pinned pages, use these variants instead of > >> + * release_pages(): > >> + */ > >> +static inline void put_user_pages_dirty(struct page **pages, > >> + unsigned long npages) > >> +{ > >> + while (npages) { > >> + set_page_dirty(pages[npages]); > >> + put_user_page(pages[npages]); > >> + --npages; > >> + } > >> +} > > > > Shouldn't these do the !PageDirty(page) thing? > > > > Well, not yet. This is the "placeholder" patch, in which I planned to keep > the behavior the same, while I go to all the get_user_pages call sites and change > put_page() and release_pages() over to use these new routines. Hmm.. Well, if it is the right thing to do here, why not include it and take it out of callers when doing the conversion? If it is the wrong thing, then let us still take it out of callers when doing the conversion :) Just seems like things will be in a better place to make future changes if all the call sights are de-duplicated and correct. Jason