• Thomas Hellstrom's avatar
    mm: Add write-protect and clean utilities for address space ranges · 4fe51e9e
    Thomas Hellstrom authored
    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.
    
    Notable changes since RFC:
    - Added comments to help avoid the usage of these function for VMAs
      it's not intended for. We also do advisory checks on the vm_flags and
      warn on illegal usage.
    - Perform the pte modifications the same way softdirty does.
    - Add mmu_notifier range invalidation calls.
    - Add a config option so that this code is not unconditionally included.
    - Tell the mmu_gather code about pending tlb flushes.
    
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: Will Deacon <will.deacon@arm.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Rik van Riel <riel@surriel.com>
    Cc: Minchan Kim <minchan@kernel.org>
    Cc: Michal Hocko <mhocko@suse.com>
    Cc: Huang Ying <ying.huang@intel.com>
    Cc: Souptick Joarder <jrdr.linux@gmail.com>
    Cc: "Jérôme Glisse" <jglisse@redhat.com>
    Cc: linux-mm@kvack.org
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: default avatarThomas Hellstrom <thellstrom@vmware.com>
    Reviewed-by: Ralph Campbell <rcampbell@nvidia.com> #v1
    4fe51e9e
MAINTAINERS 499 KB