Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8690266imu; Tue, 4 Dec 2018 12:30:39 -0800 (PST) X-Google-Smtp-Source: AFSGD/U8kGz60dDBjAZuzgcwEoxzzPi7dGKbpVlWXS9scTrNhqtirOyDUptmRW5kWffpQ5IebwJb X-Received: by 2002:a63:4c6:: with SMTP id 189mr18155512pge.391.1543955438963; Tue, 04 Dec 2018 12:30:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543955438; cv=none; d=google.com; s=arc-20160816; b=Tmz6LFt6Yhytm+7bA4lPuPkoaFX8sk8xrxBIe+2Lx8cKWjiXI470SV+cAICMeyG4sl 5xciFAYduPn2AbQultEaoVV9mkcY3VZjv5kj6nIRGY8AoKIy0Th/T/5ZnaJ5E8Bom3By W2pkh/sDy7Vh4l36x994BDmbJFfTyUBA5bQsHWZSuEb8na5QgcyWcQyRzblX/8h5GnVH t6SGYNTtRTNcaCinJyHgU2zSdaxkC03TLHjV/zJe44HPRO61+8YhUlVC0O4yl4Wc4xqA P+8Ayj8irzBnZywzNhV+idYespwwfG/AfU0Av6PM83F7Vz6eZaBm3ulCqYVOk6DNct1Z Hh3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=/EaCEfmpImkvTz3VdssIYIYR2oggAbhL8kH3SI+sFS4=; b=oNokvh1HPE4CHLAifHaA2LNAbYCmg+hF1RFksHPVUTo9rywsotAIPItPtiahQqYa4f ctndSggGWSoyQ4VdsOXwsJRNeMB3h9z1gj6HJ/WlryfUHyAumPpprIZtvd730nzVr/sD H8plnVoBqfDCSlSy7AryGGdco3fQT34a/egrePEBHug8gkeIbGWpdFeduaIf+WblmOKa Q+ZUXh83AsUL2T70ra1kyMRnhfItO7YlNTyEmTOSo59bQ47LI+yPWLwpMHkCP59+EH5Z qPqvSLGpHCyLjxdGEqKk+NYyAvEYupgeZKv8PWa8x7XmG5KwWW1dOneWB14fX7bGqmlh mkVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=NOd8zfHc; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 87si18158824pfs.7.2018.12.04.12.30.23; Tue, 04 Dec 2018 12:30:38 -0800 (PST) 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=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=NOd8zfHc; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726328AbeLDU3L (ORCPT + 99 others); Tue, 4 Dec 2018 15:29:11 -0500 Received: from mail-oi1-f194.google.com ([209.85.167.194]:36383 "EHLO mail-oi1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725906AbeLDU3L (ORCPT ); Tue, 4 Dec 2018 15:29:11 -0500 Received: by mail-oi1-f194.google.com with SMTP id x23so15496542oix.3 for ; Tue, 04 Dec 2018 12:29:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/EaCEfmpImkvTz3VdssIYIYR2oggAbhL8kH3SI+sFS4=; b=NOd8zfHc1Zwo1mNFxUxQfpthFk/xHaf51OlhY3msRAvrSSmHPxBNk5fQrFcNVYFBFl e8EM25Hq+PTdIyhibwPAnyDaCBIH7KgXMIOEsMG+gOuIX1nAPU4Sk/3MIbL6DYBVv5iD nm1owj3h/cu7HFp5c2rsDmY+LDYf81/IDxWQ6M+t9BJQRlySDS5M5jgtK5GumVZ7zas/ DKt5UO+Alve0cyDxQ89gcIRjaCfpioT9xnJ5vaDCcYsjTFodmStSqcKXiO+882q1BcQs BygZEKR3Mfq9XXw5SjopqzcRuPOWQY3Qr/p58tUFbgcn5Ah50NCkxLG5/FkoFsAb3RIO e//w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/EaCEfmpImkvTz3VdssIYIYR2oggAbhL8kH3SI+sFS4=; b=rtTqMF3r6VWPlFVJnJP4MbCTCgKDdaQ6/nHJa4oWn5V4iYadLTpnU/gBHcBToxdHli NW7ByO25TWFqYDgr5cT/MJIHeD5z34zV2CU8rc3SGF4VVfsulXVImpqglm8TAdGdSGRq tbrO0Swrpr9dfgt5kvfEnuLc/ktpycVVCiGAczodp3mhy00o8wbnqPBgZsOHO0aCYIdN A7Y34N9JYuOgJf0kNx4IehZqxhBHwXH9aCZ8b9RjxfROI86bBkfZd/LaAmKs3BWTBjaJ gf+louktZGkyQMm+zMAknm5o9HRaoRp7TgEqty1Cyny/jVGkJ10fg6dRq5Wla1M/DpLE 5vYA== X-Gm-Message-State: AA+aEWbcmQfgf9/lXgLRZlPFlVxxvsOg4vWWJl64dMrvwisy3MPQnUQ9 Aj6ae+uRLFQalfXd0E5DjGoVVW/nsw9/r7pZp1sLug== X-Received: by 2002:aca:5205:: with SMTP id g5mr13859562oib.149.1543955350462; Tue, 04 Dec 2018 12:29:10 -0800 (PST) MIME-Version: 1.0 References: <20181204001720.26138-1-jhubbard@nvidia.com> <20181204001720.26138-2-jhubbard@nvidia.com> In-Reply-To: <20181204001720.26138-2-jhubbard@nvidia.com> From: Dan Williams Date: Tue, 4 Dec 2018 12:28:59 -0800 Message-ID: Subject: Re: [PATCH 1/2] mm: introduce put_user_page*(), placeholder versions To: John Hubbard Cc: Andrew Morton , Linux MM , Jan Kara , tom@talpey.com, Al Viro , benve@cisco.com, Christoph Hellwig , Christopher Lameter , "Dalessandro, Dennis" , Doug Ledford , Jason Gunthorpe , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Matthew Wilcox , Michal Hocko , mike.marciniszyn@intel.com, rcampbell@nvidia.com, Linux Kernel Mailing List , linux-fsdevel , John Hubbard Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 3, 2018 at 4:17 PM 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(), and also as a replacement > for open-coded loops that release multiple pages. > These may be used for subsequent performance improvements, > via batching of pages to be released. > > This is the first step of fixing the problem described in [1]. The steps > are: > > 1) (This patch): provide put_user_page*() routines, intended to be used > for releasing pages that were pinned via get_user_pages*(). > > 2) Convert all of the call sites for get_user_pages*(), to > invoke put_user_page*(), instead of put_page(). This involves dozens of > call sites, and will take some time. > > 3) After (2) is complete, use get_user_pages*() and put_user_page*() to > implement tracking of these pages. This tracking will be separate from > the existing struct page refcounting. > > 4) Use the tracking and identification of these pages, to implement > special handling (especially in writeback paths) when the pages are > backed by a filesystem. Again, [1] provides details as to why that is > desirable. I thought at Plumbers we talked about using a page bit to tag pages that have had their reference count elevated by get_user_pages()? That way there is no need to distinguish put_page() from put_user_page() it just happens internally to put_page(). At the conference Matthew was offering to free up a page bit for this purpose. > [1] https://lwn.net/Articles/753027/ : "The Trouble with get_user_pages()" > > Reviewed-by: Jan Kara Wish, you could have been there Jan. I'm missing why it's safe to assume that a single put_user_page() is paired with a get_user_page()?