Skip to content
  • John Hubbard's avatar
    mm/gup_benchmark: support pin_user_pages() and related calls · 41c45d37
    John Hubbard authored
    
    
    Up until now, gup_benchmark supported testing of the following kernel
    functions:
    
    * get_user_pages(): via the '-U' command line option
    * get_user_pages_longterm(): via the '-L' command line option
    * get_user_pages_fast(): as the default (no options required)
    
    Add test coverage for the new corresponding pin_*() functions:
    
    * pin_user_pages_fast(): via the '-a' command line option
    * pin_user_pages():      via the '-b' command line option
    
    Also, add an option for clarity: '-u' for what is now (still) the default
    choice: get_user_pages_fast().
    
    Also, for the commands that set FOLL_PIN, verify that the pages really are
    dma-pinned, via the new is_dma_pinned() routine.  Those commands are:
    
        PIN_FAST_BENCHMARK     : calls pin_user_pages_fast()
        PIN_BENCHMARK          : calls pin_user_pages()
    
    In between the calls to pin_*() and unpin_user_pages(), check each page:
    if page_maybe_dma_pinned() returns false, then WARN and return.
    
    Do this outside of the benchmark timestamps, so that it doesn't affect
    reported times.
    
    Signed-off-by: default avatarJohn Hubbard <jhubbard@nvidia.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Reviewed-by: default avatarIra Weiny <ira.weiny@intel.com>
    Acked-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Cc: Jan Kara <jack@suse.cz>
    Cc: Jérôme Glisse <jglisse@redhat.com>
    Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Cc: Christoph Hellwig <hch@infradead.org>
    Cc: Dan Williams <dan.j.williams@intel.com>
    Cc: Dave Chinner <david@fromorbit.com>
    Cc: Jason Gunthorpe <jgg@ziepe.ca>
    Cc: Jonathan Corbet <corbet@lwn.net>
    Cc: Michal Hocko <mhocko@suse.com>
    Cc: Mike Kravetz <mike.kravetz@oracle.com>
    Cc: Shuah Khan <shuah@kernel.org>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Link: http://lkml.kernel.org/r/20200211001536.1027652-10-jhubbard@nvidia.com
    
    
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    41c45d37