Skip to content
  • Ross Zwisler's avatar
    mm: avoid spurious 'bad pmd' warning messages · d0f0931d
    Ross Zwisler authored
    When the pmd_devmap() checks were added by 5c7fb56e ("mm, dax:
    dax-pmd vs thp-pmd vs hugetlbfs-pmd") to add better support for DAX huge
    pages, they were all added to the end of if() statements after existing
    pmd_trans_huge() checks.  So, things like:
    
      -       if (pmd_trans_huge(*pmd))
      +       if (pmd_trans_huge(*pmd) || pmd_devmap(*pmd))
    
    When further checks were added after pmd_trans_unstable() checks by
    commit 7267ec00 ("mm: postpone page table allocation until we have
    page to map") they were also added at the end of the conditional:
    
      +       if (pmd_trans_unstable(fe->pmd) || pmd_devmap(*fe->pmd))
    
    This ordering is fine for pmd_trans_huge(), but doesn't work for
    pmd_trans_unstable().  This is because DAX huge pages trip the bad_pmd()
    check inside of pmd_none_or_trans_huge_or_clear_bad() (called by
    pmd_trans_unstable()), which prints out a warning and returns 1.  So, we
    do end up doing the right thing, but only after spamming dmesg with
    suspicious looking messages:
    
      mm/pgtable-generic.c:39: bad pmd ffff8808daa49b88(84000001006000a5)
    
    Reorder these checks in a helper so that pmd_devmap() is checked first,
    avoiding the error messages, and add a comment explaining why the
    ordering is important.
    
    Fixes: commit 7267ec00 ("mm: postpone page table allocation until we have page to map")
    Link: http://lkml.kernel.org/r/20170522215749.23516-1-ross.zwisler@linux.intel.com
    
    
    Signed-off-by: default avatarRoss Zwisler <ross.zwisler@linux.intel.com>
    Reviewed-by: default avatarJan Kara <jack@suse.cz>
    Cc: Pawel Lebioda <pawel.lebioda@intel.com>
    Cc: "Darrick J. Wong" <darrick.wong@oracle.com>
    Cc: Alexander Viro <viro@zeniv.linux.org.uk>
    Cc: Christoph Hellwig <hch@lst.de>
    Cc: Dan Williams <dan.j.williams@intel.com>
    Cc: Dave Hansen <dave.hansen@intel.com>
    Cc: Matthew Wilcox <mawilcox@microsoft.com>
    Cc: "Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>
    Cc: Dave Jiang <dave.jiang@intel.com>
    Cc: Xiong Zhou <xzhou@redhat.com>
    Cc: Eryu Guan <eguan@redhat.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    d0f0931d