Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp269442imm; Mon, 9 Jul 2018 01:08:34 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdSqcse07wNEzMXst9ONSBOwa6ThX6XXTSoPlJszwXf0T99sXf2yZKE1EcpEcwjNjldjkKe X-Received: by 2002:a17:902:780e:: with SMTP id p14-v6mr14922915pll.239.1531123714645; Mon, 09 Jul 2018 01:08:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531123714; cv=none; d=google.com; s=arc-20160816; b=a0e0bIdF9LWsiSMLiouLRzyhUMB4Yn1IoJeMVbr5aLLZJFcA4ihmso8PUb3wT5ehmq xELQzzXOgayX7fXhAplNT3fw5GsrwVPYmVQpBPXUX53pd3QtkbWOtUwtdq8OXZHKlqEg VD2y1b8qxwKOAepEb0ubYocTv7Vp+SjHaQBDgoz8cspdk4FvMXht6VztCeimsXJ60psf J0TU1b0ce94w7uWQy9EKE83vVBDdzsDJZbJstP5FSD39c4/KBXrweGlRdJL4+MhhHIii BlQVs0/HOce0K1rdKfXh+SK/RTvHihJ6TLznlAzXopw0PhBQ+t/yRcyK5IeLnvj6TOgk 1M8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=iNE6i0Hmy54tGp8si6jfYP4LCdfX2UFK3bwY4oVddoM=; b=Ob8p2tDYhSalpDKYN6KZtUuxFRShvKshBIdAyQniJemiSV8Fh6fD1vsyV3dDmEGHta CA6FMvBoDC4MBf7fFh1VbeoluwWHVDrEcRHQhEIE6GzV3rOGZhM0+EhRQvdJQvRp7ynp o9RkWik/mMn45E6r3oVceKPruwTgf0xd0x65nnNcqSDJPHo2rQDojtNU8ryNxVT6pCdB BJZIRxPzfxdWBlnymzDkfEbKcQ77U87gAxG0oBgHm2fOA9+sQTC9yBMGTPCKRXvLc23X ZTZmakqrxnAxq3dywSvxcKQmlbolN7pqk1xhCMPGXdxrzjqPOVY5bxpook9cZsirZSGy 6HeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=f5UmDX00; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m37-v6si14418829plg.491.2018.07.09.01.08.20; Mon, 09 Jul 2018 01:08:34 -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=@gmail.com header.s=20161025 header.b=f5UmDX00; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754317AbeGIIGg (ORCPT + 99 others); Mon, 9 Jul 2018 04:06:36 -0400 Received: from mail-yb0-f194.google.com ([209.85.213.194]:44780 "EHLO mail-yb0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750789AbeGIIGc (ORCPT ); Mon, 9 Jul 2018 04:06:32 -0400 Received: by mail-yb0-f194.google.com with SMTP id a2-v6so6846858ybe.11; Mon, 09 Jul 2018 01:06:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=iNE6i0Hmy54tGp8si6jfYP4LCdfX2UFK3bwY4oVddoM=; b=f5UmDX00DndUq6MCXz8a+4r4nsVatA0QYsnCjhaMzs5fxWU/ep8YVn66EW7EAXaOP1 oArlLUl3YDTl46IgaYiZdjfQhHXDtOLdFNMp5SCKyS+NFyYjV3okvF4tP+MyQCjcofEV fQ1PUE9y1cUwH+PJZWnO5QJ7n83iZhw2EtdJESyHfQVYWSeYLAjmOiD3MiT9Tb2/hgFZ QuM80dv3ltkkYw+Dc8DaNqZq7j9RTaTML5llIECOPSb8TSsYvpeJZm3uFW+W6ZsHFII8 VXdxLUSxc4RNZhpoER1HPeMx94gz+cz6tmD/GDBLov++uLtCm9cXmY15/HM3vlmiphE/ ujuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=iNE6i0Hmy54tGp8si6jfYP4LCdfX2UFK3bwY4oVddoM=; b=GuCkgDKaHDui4LHx2upxBbfuCJnNGQinAqvO0j7MZ7VUpvffAPnra9FEmrhMzeoOh2 5bkjEOoD6S3bYkmu63kVNlxtWmaqol1voY2wEcZDUmhHU/nKuXhObytWS4qPPJY7MUj+ k3rvA+lA0rzI1Z2uQkyS8pYvrfHbwGVSP3eevQ8aviqWVI7mVZ8D9bwuQ2Xs1mz9w1wP MxXDC0Szbbbif4IWZ8bOrxX1aZGL/POlGuowxqoi+plg+IFzftzF75R3dnvFMW8dkgeL VDValY2m+B5gywGYIBC3vcSIGLUYK7yrDLu0R5EJ93rapSFzc90ULcZt6UrjKm1nsJP/ HIFw== X-Gm-Message-State: APt69E2iKheza5tyINwMrRHFSl7DeRbcupgyPejjrFgFidyhqqLLIxmi 764sBHzuQJlhjZyjdpUVd3Q= X-Received: by 2002:a25:9c44:: with SMTP id x4-v6mr10114470ybo.230.1531123592137; Mon, 09 Jul 2018 01:06:32 -0700 (PDT) Received: from sandstorm.nvidia.com ([2600:1700:43b0:3120:feaa:14ff:fe9e:34cb]) by smtp.gmail.com with ESMTPSA id w64-v6sm6339514ywe.46.2018.07.09.01.06.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Jul 2018 01:06:31 -0700 (PDT) From: john.hubbard@gmail.com X-Google-Original-From: jhubbard@nvidia.com To: Matthew Wilcox , Michal Hocko , Christopher Lameter , Jason Gunthorpe , Dan Williams , Jan Kara , Al Viro Cc: linux-mm@kvack.org, LKML , linux-rdma , linux-fsdevel@vger.kernel.org, John Hubbard Subject: [PATCH 0/2] mm/fs: put_user_page() proposal Date: Mon, 9 Jul 2018 01:05:52 -0700 Message-Id: <20180709080554.21931-1-jhubbard@nvidia.com> X-Mailer: git-send-email 2.18.0 X-NVConfidentiality: public Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: John Hubbard Hi, 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. 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. 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 John Hubbard (2): mm: introduce put_user_page(), placeholder version goldfish_pipe/mm: convert to the new put_user_page() call drivers/platform/goldfish/goldfish_pipe.c | 6 +++--- include/linux/mm.h | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) -- 2.18.0