• Andrew Morton's avatar
    [PATCH] Fix swp_entry_t encoding · 4a25c3d6
    Andrew Morton authored
    From: Martin Schwidefsky <schwidefsky@de.ibm.com>
    
    This fixes a problem in sys_swapon that can cause the creation of invalid
    swap ptes.  This has its cause in the arch-independent swap entries vs. 
    the pte coded swap entries.  The swp_entry_t uses 27 bits for the offset
    and 5 bits for the type.  In sys_swapon this definition is used to find how
    many swap devices and how many pages on each device there can be.  But the
    swap entries encoded in a pte can be subject to additional restrictions due
    to the hardware besides the 27/5 division of the bits in the swp_entry_t
    type.  This is solved by adding pte_to_swp_entry and swp_entry_to_pte calls
    to the calculations for maximum type and offset.
    
    In addition the s390 swap pte division for offset/type is changed from 19/6
    bits to 20/5 bits.
    4a25c3d6
swapfile.c 39.8 KB