• David Hildenbrand's avatar
    sh/mm: support __HAVE_ARCH_PTE_SWP_EXCLUSIVE · cca10df1
    David Hildenbrand authored
    Let's support __HAVE_ARCH_PTE_SWP_EXCLUSIVE by using bit 6 in the PTE,
    reducing the swap type in the !CONFIG_X2TLB case to 5 bits.  Generic MM
    currently only uses 5 bits for the type (MAX_SWAPFILES_SHIFT), so the
    stolen bit is effectively unused.
    
    Interrestingly, the swap type in the !CONFIG_X2TLB case could currently
    overlap with the _PAGE_PRESENT bit, because there is a sneaky shift by 1
    in __pte_to_swp_entry() and __swp_entry_to_pte().  Bit 0-7 in the
    architecture specific swap PTE would get shifted to bit 1-8 in the PTE. 
    As generic MM uses 5 bits only, this didn't matter so far.
    
    While at it, mask the type in __swp_entry().
    
    Link: https://lkml.kernel.org/r/20230113171026.582290-21-david@redhat.comSigned-off-by: default avatarDavid Hildenbrand <david@redhat.com>
    Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
    Cc: Rich Felker <dalias@libc.org>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    cca10df1
pgtable_32.h 16.6 KB