• zhongjiang's avatar
    mm: hwpoison: fix thp split handing in soft_offline_in_use_page() · 46612b75
    zhongjiang authored
    When soft_offline_in_use_page() runs on a thp tail page after pmd is
    split, we trigger the following VM_BUG_ON_PAGE():
    
      Memory failure: 0x3755ff: non anonymous thp
      __get_any_page: 0x3755ff: unknown zero refcount page type 2fffff80000000
      Soft offlining pfn 0x34d805 at process virtual address 0x20fff000
      page:ffffea000d360140 count:0 mapcount:0 mapping:0000000000000000 index:0x1
      flags: 0x2fffff80000000()
      raw: 002fffff80000000 ffffea000d360108 ffffea000d360188 0000000000000000
      raw: 0000000000000001 0000000000000000 00000000ffffffff 0000000000000000
      page dumped because: VM_BUG_ON_PAGE(page_ref_count(page) == 0)
      ------------[ cut here ]------------
      kernel BUG at ./include/linux/mm.h:519!
    
    soft_offline_in_use_page() passed refcount and page lock from tail page
    to head page, which is not needed because we can pass any subpage to
    split_huge_page().
    
    Naoya had fixed a similar issue in c3901e72 ("mm: hwpoison: fix thp
    split han...
    46612b75
memory-failure.c 52.1 KB