• Gerald Schaefer's avatar
    s390/mm: simplify page table helpers for large entries · 2d1fc1eb
    Gerald Schaefer authored
    For pmds and puds, there are a couple of page table helper functions that
    only make sense for large entries, like pxd_(mk)dirty/young/write etc.
    
    We currently explicitly check if the entries are large, but in practice
    those functions must never be used for normal entries, which point to lower
    level page tables, so the code can be simplified.
    
    This also fixes a theoretical bug, where common code could use one of the
    functions before actually marking a pmd large, like this:
    
    pmd = pmd_mkhuge(pmd_mkdirty(pmd))
    
    With the current implementation, the resulting large pmd would not be dirty
    as requested. This could in theory result in the loss of dirty information,
    e.g. after collapsing into a transparent hugepage. Common code currently
    always marks an entry large before using one of the functions, but there is
    no hard requirement for this. The only requirement would be that it never
    uses the functions for normal entries pointing to lower level page tables,
    but they might be called before marking an entry large during its creation.
    
    In order to avoid issues with future common code, and to simplify the page
    table helpers, remove the checks for large entries and rely on common code
    never using them for normal entries.
    
    This was found by testing a patch from from Anshuman Khandual, which is
    currently discussed on LKML ("mm/debug: Add tests validating architecture
    page table helpers").
    Signed-off-by: default avatarGerald Schaefer <gerald.schaefer@de.ibm.com>
    Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
    2d1fc1eb
pgtable.h 48.7 KB