This is potentially useful debugging information and matches the existing page offset provided. We only do so if the VMA is not a shared mapping, as shared mappings ignore the virtual page offset. We use __linear_virt_page_offset() as the VMA may be shared. Signed-off-by: Lorenzo Stoakes --- mm/memory.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index f5eb06544ba4..7890e5200ecb 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -588,21 +588,23 @@ static void print_bad_page_map(struct vm_area_struct *vma, enum pgtable_level level) { struct address_space *mapping; - pgoff_t index; + pgoff_t index, virt_index; if (is_bad_page_map_ratelimited()) return; mapping = vma->vm_file ? vma->vm_file->f_mapping : NULL; index = linear_page_index(vma, addr); + virt_index = __linear_virt_page_index(vma, addr); pr_alert("BUG: Bad page map in process %s %s:%08llx", current->comm, pgtable_level_to_str(level), entry); __print_bad_page_map_pgtable(vma->vm_mm, addr); if (page) dump_page(page, "bad page map"); - pr_alert("addr:%px vm_flags:%08lx anon_vma:%px mapping:%px index:%lx\n", - (void *)addr, vma->vm_flags, vma->anon_vma, mapping, index); + pr_alert("addr:%px vm_flags:%08lx anon_vma:%px mapping:%px index:%lx virt_index:%lx\n", + (void *)addr, vma->vm_flags, vma->anon_vma, mapping, index, + virt_index); pr_alert("file:%pD fault:%ps mmap:%ps mmap_prepare: %ps read_folio:%ps\n", vma->vm_file, vma->vm_ops ? vma->vm_ops->fault : NULL, -- 2.54.0