• Alex Sierra's avatar
    mm: rename is_pinnable_page() to is_longterm_pinnable_page() · 6077c943
    Alex Sierra authored
    Patch series "Add MEMORY_DEVICE_COHERENT for coherent device memory
    mapping", v9.
    
    This patch series introduces MEMORY_DEVICE_COHERENT, a type of memory
    owned by a device that can be mapped into CPU page tables like
    MEMORY_DEVICE_GENERIC and can also be migrated like MEMORY_DEVICE_PRIVATE.
    
    This patch series is mostly self-contained except for a few places where
    it needs to update other subsystems to handle the new memory type.
    
    System stability and performance are not affected according to our ongoing
    testing, including xfstests.
    
    How it works: The system BIOS advertises the GPU device memory (aka VRAM)
    as SPM (special purpose memory) in the UEFI system address map.
    
    The amdgpu driver registers the memory with devmap as
    MEMORY_DEVICE_COHERENT using devm_memremap_pages.  The initial user for
    this hardware page migration capability is the Frontier supercomputer
    project.  This functionality is not AMD-specific.  We expect other GPU
    vendors to find this functionality useful, and possibly other hardware
    types in the future.
    
    Our test nodes in the lab are similar to the Frontier configuration, with
    .5 TB of system memory plus 256 GB of device memory split across 4 GPUs,
    all in a single coherent address space.  Page migration is expected to
    improve application efficiency significantly.  We will report empirical
    results as they become available.
    
    Coherent device type pages at gup are now migrated back to system memory
    if they are being pinned long-term (FOLL_LONGTERM).  The reason is, that
    long-term pinning would interfere with the device memory manager owning
    the device-coherent pages (e.g.  evictions in TTM).  These series
    incorporate Alistair Popple patches to do this migration from
    pin_user_pages() calls.  hmm_gup_test has been added to hmm-test to test
    different get user pages calls.
    
    This series includes handling of device-managed anonymous pages returned
    by vm_normal_pages.  Although they behave like normal pages for purposes
    of mapping in CPU page tables and for COW, they do not support LRU lists,
    NUMA migration or THP.
    
    We also introduced a FOLL_LRU flag that adds the same behaviour to
    follow_page and related APIs, to allow callers to specify that they expect
    to put pages on an LRU list.
    
    
    This patch (of 14):
    
    is_pinnable_page() and folio_is_pinnable() are renamed to
    is_longterm_pinnable_page() and folio_is_longterm_pinnable() respectively.
    These functions are used in the FOLL_LONGTERM flag context.
    
    Link: https://lkml.kernel.org/r/20220715150521.18165-1-alex.sierra@amd.com
    Link: https://lkml.kernel.org/r/20220715150521.18165-2-alex.sierra@amd.comSigned-off-by: default avatarAlex Sierra <alex.sierra@amd.com>
    Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
    Cc: Jason Gunthorpe <jgg@nvidia.com>
    Cc: Felix Kuehling <Felix.Kuehling@amd.com>
    Cc: Ralph Campbell <rcampbell@nvidia.com>
    Cc: Christoph Hellwig <hch@lst.de>
    Cc: Jerome Glisse <jglisse@redhat.com>
    Cc: Alistair Popple <apopple@nvidia.com>
    Cc: Matthew Wilcox <willy@infradead.org>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    6077c943
gup_test.c 5.59 KB