Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp845923imm; Fri, 5 Oct 2018 12:50:58 -0700 (PDT) X-Google-Smtp-Source: ACcGV61TZHNptpjrI6PyKK7eEm1aNFnvtEAuBnBC0skn1Hjhp3paylpxEkG2GhnlDxqFXZkyron6 X-Received: by 2002:a65:62d5:: with SMTP id m21-v6mr11710386pgv.243.1538769058058; Fri, 05 Oct 2018 12:50:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538769058; cv=none; d=google.com; s=arc-20160816; b=KOrwZxy2hqAbIMXRpxMNUxC1d4mU6BbT5gD41hmQ06EboxHMzq5ZQEkWs8i36XiwHt jfh2k54Khtzw4w97KTo31FIjT5lwXAp3Y0oCnq2Y1TFXCX/4myZsK5yeclVyYC+dxJCW psdQ5X3G/vsdt6zSqjhwUUp6k062Wp9Ji2unKETn8qoF1ru3uHK6tXs7KqVXgg7J2vq+ kwfHZlLwS3/4hKC5nIrAMXQA/jB+ov3lVku4agqlNiNhmSzwyvlYyMXwxaN1ZoDGzGga D/m+gBXp5Zc9eNCfslItWS9gSgcX0zDXAaoeRkql2HPl5evRrrH9xtxb5OkYUWicfhLG jlBQ== 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=A44HVFpuTyXFHxDlpQtKpZC5RyVPcULm1rkwlmyrEdw=; b=WanfUh9TIu6BMBkDupdTDXj126LjD6uhNzXiW6ZI8ZJlV0H7duicxvMA2/EJQ7MNwS RkfspDkdGVMxDBce1EZVPFyYOkp6jFxYZizxqzZkVVTF61mKUKTI7idn5Kw3QHZ6l4eE 2tdnHYt/5MRWKg1v8tQfsf2qoLrDUwhYCVMk1wmowLs9Re+ny9Cv5zbnwI9Gt6QZAOAp vvlQvY5gX/ozYJmV1oYsa/MGfgRKUI7u8cM6GQcDiY3STVZDHpYbUnLy/6bJrxpShZzZ 2oTn5ydw/oaNSNoaTQPQYhrYtnzi+heZn64RauCnLxL6KSlxB39bYn7+CRCINh6eWG0h DqJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=Hc52I6T4; 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 d4-v6si9154385pgj.341.2018.10.05.12.50.42; Fri, 05 Oct 2018 12:50:58 -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=Hc52I6T4; 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 S1728674AbeJFCtV (ORCPT + 99 others); Fri, 5 Oct 2018 22:49:21 -0400 Received: from hqemgate15.nvidia.com ([216.228.121.64]:16508 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728061AbeJFCtV (ORCPT ); Fri, 5 Oct 2018 22:49:21 -0400 Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Fri, 05 Oct 2018 12:48:31 -0700 Received: from HQMAIL101.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Fri, 05 Oct 2018 12:49:07 -0700 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Fri, 05 Oct 2018 12:49:07 -0700 Received: from [10.110.48.28] (10.124.1.5) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 5 Oct 2018 19:49:06 +0000 Subject: Re: [PATCH v2 2/3] mm: introduce put_user_page[s](), placeholder versions To: Jason Gunthorpe , CC: Matthew Wilcox , Michal Hocko , Christopher Lameter , Dan Williams , Jan Kara , , LKML , linux-rdma , , Al Viro , Jerome Glisse , Christoph Hellwig References: <20181005040225.14292-1-jhubbard@nvidia.com> <20181005040225.14292-3-jhubbard@nvidia.com> <20181005151726.GA20776@ziepe.ca> From: John Hubbard Message-ID: Date: Fri, 5 Oct 2018 12:49:06 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: <20181005151726.GA20776@ziepe.ca> X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL101.nvidia.com (172.20.187.10) Content-Type: text/plain; charset="utf-8" Content-Language: en-US-large Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1538768911; bh=A44HVFpuTyXFHxDlpQtKpZC5RyVPcULm1rkwlmyrEdw=; h=X-PGP-Universal:Subject:To:CC:References:From:Message-ID:Date: User-Agent:MIME-Version:In-Reply-To:X-Originating-IP: X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=Hc52I6T4bTE+nh7vWtchnbb6xb64C7nm7UnFkOa0fXkALf+gVTtFuLjbe7VxP9FiG tpK97sfm4EtvpLtXihP/MteVE7V2ik1ar2dnOKX4TOHZVcAA5pc1aZ1yrUeavneXnl /PIY3yWLPFsLV/4FkXqR55PeXV3Vm3mjmAb2+p74q1wUKcnx57zLlX7nFiR9+/etdr GDaMNofEQ9Lv69guUJhqH/qir8ukXqiLtOLn+tOa9Ss3BB6xpQqh3PtB99ZHpTsCbO VeH7hGKLdTmBGbYpA2Z15CXvZqcDQQhsLSEQ3TPWz/CRI35bKraDFI8tjlMWW3CIW/ vh1t/KIhzZyQw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. After the call sites are changed, then these routines will be updated to do more. [2], above has slightly more detail about that. thanks, -- John Hubbard NVIDIA