• Naoya Horiguchi's avatar
    mm, hwpoison, hugetlb: support saving mechanism of raw error pages · 161df60e
    Naoya Horiguchi authored
    When handling memory error on a hugetlb page, the error handler tries to
    dissolve and turn it into 4kB pages.  If it's successfully dissolved,
    PageHWPoison flag is moved to the raw error page, so that's all right. 
    However, dissolve sometimes fails, then the error page is left as
    hwpoisoned hugepage.  It's useful if we can retry to dissolve it to save
    healthy pages, but that's not possible now because the information about
    where the raw error pages is lost.
    
    Use the private field of a few tail pages to keep that information.  The
    code path of shrinking hugepage pool uses this info to try delayed
    dissolve.  In order to remember multiple errors in a hugepage, a
    singly-linked list originated from SUBPAGE_INDEX_HWPOISON-th tail page is
    constructed.  Only simple operations (adding an entry or clearing all) are
    required and the list is assumed not to be very long, so this simple data
    structure should be enough.
    
    If we failed to save raw error info, the hwpoison hugepage has errors on
    unknown subpage, then this new saving mechanism does not work any more, so
    disable saving new raw error info and freeing hwpoison hugepages.
    
    Link: https://lkml.kernel.org/r/20220714042420.1847125-4-naoya.horiguchi@linux.devSigned-off-by: default avatarNaoya Horiguchi <naoya.horiguchi@nec.com>
    Reported-by: default avatarkernel test robot <lkp@intel.com>
    Reviewed-by: default avatarMiaohe Lin <linmiaohe@huawei.com>
    Cc: David Hildenbrand <david@redhat.com>
    Cc: Liu Shixin <liushixin2@huawei.com>
    Cc: Mike Kravetz <mike.kravetz@oracle.com>
    Cc: Muchun Song <songmuchun@bytedance.com>
    Cc: Oscar Salvador <osalvador@suse.de>
    Cc: Yang Shi <shy828301@gmail.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    161df60e
memory-failure.c 67.7 KB