From: "Kirill A. Shutemov" Subject: Re: [PATCH 1/7] mm: Add write-protect and clean utilities for address space ranges Date: Wed, 18 Sep 2019 17:41:02 +0300 Message-ID: <20190918144102.jkukmhifmweagmwt@box> References: <20190918125914.38497-1-thomas_os@shipmail.org> <20190918125914.38497-2-thomas_os@shipmail.org> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Return-path: Content-Disposition: inline In-Reply-To: <20190918125914.38497-2-thomas_os@shipmail.org> Sender: linux-kernel-owner@vger.kernel.org To: Thomas =?utf-8?Q?Hellstr=C3=B6m_=28VMware=29?= Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mm@kvack.org, pv-drivers@vmware.com, linux-graphics-maintainer@vmware.com, Thomas Hellstrom , Andrew Morton , Matthew Wilcox , Will Deacon , Peter Zijlstra , Rik van Riel , Minchan Kim , Michal Hocko , Huang Ying , Souptick Joarder , =?utf-8?B?SsOpcsO0bWU=?= Glisse , Ralph Campbell List-Id: dri-devel@lists.freedesktop.org On Wed, Sep 18, 2019 at 02:59:08PM +0200, Thomas Hellström (VMware) wrote: > From: Thomas Hellstrom > > Add two utilities to a) write-protect and b) clean all ptes pointing into > a range of an address space. > The utilities are intended to aid in tracking dirty pages (either > driver-allocated system memory or pci device memory). > The write-protect utility should be used in conjunction with > page_mkwrite() and pfn_mkwrite() to trigger write page-faults on page > accesses. Typically one would want to use this on sparse accesses into > large memory regions. The clean utility should be used to utilize > hardware dirtying functionality and avoid the overhead of page-faults, > typically on large accesses into small memory regions. > > The added file "as_dirty_helpers.c" is initially listed as maintained by > VMware under our DRM driver. If somebody would like it elsewhere, > that's of course no problem. After quick glance, it looks a lot as rmap code duplication. Why not extend rmap_walk() interface instead to cover range of pages? > > Cc: Andrew Morton > Cc: Matthew Wilcox > Cc: Will Deacon > Cc: Peter Zijlstra > Cc: Rik van Riel > Cc: Minchan Kim > Cc: Michal Hocko > Cc: Huang Ying > Cc: Souptick Joarder > Cc: "Jérôme Glisse" > Cc: linux-mm@kvack.org > Cc: linux-kernel@vger.kernel.org > > Signed-off-by: Thomas Hellstrom > Reviewed-by: Ralph Campbell #v1 > --- > MAINTAINERS | 1 + > include/linux/mm.h | 13 +- > mm/Kconfig | 3 + > mm/Makefile | 1 + > mm/as_dirty_helpers.c | 392 ++++++++++++++++++++++++++++++++++++++++++ > 5 files changed, 409 insertions(+), 1 deletion(-) > create mode 100644 mm/as_dirty_helpers.c > > diff --git a/MAINTAINERS b/MAINTAINERS > index c2d975da561f..b596c7cf4a85 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -5287,6 +5287,7 @@ T: git git://people.freedesktop.org/~thomash/linux > S: Supported > F: drivers/gpu/drm/vmwgfx/ > F: include/uapi/drm/vmwgfx_drm.h > +F: mm/as_dirty_helpers.c Emm.. No. Core MM functinality cannot belong to random driver. -- Kirill A. Shutemov