Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp724957imm; Mon, 9 Jul 2018 09:29:26 -0700 (PDT) X-Google-Smtp-Source: AAOMgpenyPxeooUdnCsSsTibDn06mW3EBGb4/ujzsCY2dXMNMmmWy8IzEC6FPppIrtJqB0GkLfqK X-Received: by 2002:a62:444d:: with SMTP id r74-v6mr21778746pfa.96.1531153766492; Mon, 09 Jul 2018 09:29:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531153766; cv=none; d=google.com; s=arc-20160816; b=0w22pbOahd8D1GM+xbPKlVEwaFVxVG/bjulIz21yNtiDESI2X2AYHknxpYBMjQoZG6 Qc0T07+B/5JmzYpp6399I5xCrZLGERcJCi1pfP6qYTueRlSd9bz5glXgOn1abqXFv8u2 2h9p293B/BHV9Cnd0d1pfDxkp/gmYJtewPxA0v56qMntSu763Lm0L2WvOfrm7Ux5rHCb CmpJb99ND/i54ZlRruxPfnNYyijfUkWZpPjen7WMexcZr9KWNaYK02IBPuiLkRaT2EGV qMTu3LmEvh6vfw+W5en51AAI+xyOGKJ0iXSDrEuNRsnvrvH/aVnex6cCKeWoXys8G1y+ hqyg== 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:arc-authentication-results; bh=I8/GVjjq11wSWTFKZiF9IkORBSEV/Yif/cmUNEQeER8=; b=VdrnCtQvJg1AzPDnkefOHpxlVEZCUt6SMbwFsRJONBdlYNEknsJ7++rWbrhPHXiVNE D3hXk+EFESFyy49iav/afVGMUp+R3xxt+PIcUcAOF0FAFep0MNV4z+C7YxADgT80riGx PBd/XF5TbAoMOmmrHHzeVQV2kEWujlbldUkxTAGuSvEIKDKgJxb/q54cPiA5gHoYcmbY kFF5U5I6fUcy0h8d60rNly8UetvZmwHDqceyV0fyqNFtYI6/uMZwrUlEkLmYv1zZb7Je iJsIhNq79WJTTBh0QM1kT1o2d7qkIPxC3cwDTG37EIvgfuCqpRxLbO8mzhzZU4T5AK06 IM0Q== ARC-Authentication-Results: i=1; mx.google.com; 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 e33-v6si15051902pld.231.2018.07.09.09.29.11; Mon, 09 Jul 2018 09:29:26 -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; 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 S933188AbeGIQ2N (ORCPT + 99 others); Mon, 9 Jul 2018 12:28:13 -0400 Received: from mx2.suse.de ([195.135.220.15]:54088 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754459AbeGIQ2H (ORCPT ); Mon, 9 Jul 2018 12:28:07 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 12ECEACA9; Mon, 9 Jul 2018 16:28:06 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 32E8F1E0DD5; Mon, 9 Jul 2018 18:27:58 +0200 (CEST) Date: Mon, 9 Jul 2018 18:27:58 +0200 From: Jan Kara To: john.hubbard@gmail.com Cc: Matthew Wilcox , Michal Hocko , Christopher Lameter , Jason Gunthorpe , Dan Williams , Jan Kara , Al Viro , linux-mm@kvack.org, LKML , linux-rdma , linux-fsdevel@vger.kernel.org, John Hubbard Subject: Re: [PATCH 0/2] mm/fs: put_user_page() proposal Message-ID: <20180709162758.slewonsgbly4uhhg@quack2.suse.cz> References: <20180709080554.21931-1-jhubbard@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180709080554.21931-1-jhubbard@nvidia.com> User-Agent: NeoMutt/20170912 (1.9.0) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Mon 09-07-18 01:05:52, john.hubbard@gmail.com wrote: > From: John Hubbard > > With respect to tracking get_user_pages*() pages with page->dma_pinned* > fields [1], I spent a few days retrofitting most of the get_user_pages*() > call sites, by adding calls to a new put_user_page() function, in place > of put_page(), where appropriate. This will work, but it's a large effort. > > Design note: I didn't see anything that hinted at a way to fix this > problem, without actually changing all of the get_user_pages*() call sites, > so I think it's reasonable to start with that. Agreed. > Anyway, it's still incomplete, but because this is a large, tree-wide > change (that will take some time and testing), I'd like to propose a plan, > before spamming zillions of people with put_user_page() conversion patches. > So I picked out the first two patches to show where this is going. > > Proposed steps: > > Step 1: > > Start with the patches here, then continue with...dozens more. > This will eventually convert all of the call sites to use put_user_page(). > This is easy in some places, but complex in others, such as: > > -- drivers/gpu/drm/amd > -- bio > -- fuse > -- cifs > -- anything from: > git grep iov_iter_get_pages | cut -f1 -d ':' | sort | uniq > > The easy ones can be grouped into a single patchset, perhaps, and the > complex ones probably each need a patchset, in order to get the in-depth > review they'll need. Agreed. > Furthermore, some of these areas I hope to attract some help on, once > this starts going. > > Step 2: > > In parallel, tidy up the core patchset that was discussed in [1], (version > 2 has already been reviewed, so I know what to do), and get it perfected > and reviewed. Don't apply it until step 1 is all done, though. > > Step 3: > > Activate refcounting of dma-pinned pages (essentially, patch #5, which is > [1]), but don't use it yet. Place a few WARN_ON_ONCE calls to start > mopping up any missed call sites. > > Step 4: > > After some soak time, actually connect it up (patch #6 of [1]) and start > taking action based on the new page->dma_pinned* fields. > > [1] https://www.spinics.net/lists/linux-mm/msg156409.html > > or, the same thread on LKML if it's working for you: > > https://lkml.org/lkml/2018/7/4/368 Yeah, but as Nick pointed out we have some more work to do in step 4 to avoid deadlocks. Still there's a lot of work to do on which the direction to progress is clear :). Honza -- Jan Kara SUSE Labs, CR