Re: kernel BUG at include/linux/swapops.h:LINE!

From: Matthew Wilcox
Date: Wed Jul 29 2020 - 15:54:46 EST


On Wed, Jul 29, 2020 at 10:21:51PM +0300, Kirill A. Shutemov wrote:
> On Mon, Jul 27, 2020 at 01:03:10PM +0100, Matthew Wilcox wrote:
> > > It would be interesting to know if the migration entires ever got removed
> > > for pfn. I mean if remove_migration_pte() got called for it.
> > >
> > > It can be rmap issue too. Maybe it misses PMD on remove_migration_ptes()
> > > or something.
> >
> > It's not mapped with a PMD. I tweaked my debugging slightly:
> >
> > static inline swp_entry_t make_migration_entry(struct page *page, int write)
> > {
> > - BUG_ON(!PageLocked(compound_head(page)));
> > + VM_BUG_ON_PAGE(!PageLocked(page), page);
> >
> > +if (PageHead(page)) dump_page(page, "make entry");
> > +if (PageTail(page)) printk("pfn %lx order %d\n", page_to_pfn(page), thp_order(thp_head(page)));
> >
> > 1523 page:0000000006f62206 refcount:490 mapcount:1 mapping:0000000000000000 index:0x562b12a00 pfn:0x1dc00
> > 1523 head:0000000006f62206 order:9 compound_mapcount:0 compound_pincount:0
> > 1523 anon flags: 0x400000000009003d(locked|uptodate|dirty|lru|active|head|swapbacked)
> > 1523 raw: 400000000009003d ffffecfd41301308 ffffecfd41b08008 ffff9e9971c00059
> > 1523 raw: 0000000562b12a00 0000000000000000 000001ea00000000 0000000000000000
> > 1523 page dumped because: make entry
> > 1523 pfn 1dc01 order 9
> > 1523 pfn 1dc02 order 9
> > 1523 pfn 1dc03 order 9
> > ...
> >
> > Notice that it's an anonymous page, so it's not related to my work.
>
> I don't have much hope, but could you try if the patch below would blow
> up?

Running it now. Results probably in twenty minutes.

> Could you share the setup you use to trigger the issue? I want try it
> myself.

Head commit d8b18bdf9870b131802d641f5e7f32ddc53dcce3 which you can find
in http://git.infradead.org/users/willy/pagecache.git

I'm using Kent Overstreet's ktest as the base:
https://github.com/koverstreet/ktest

from the root of the kernel tree, I type:
$ ../ktest/build-test-kernel run ../ktest/tests/xfs.ktest

xfs.ktest is not in Kent's repo:

#!/bin/bash

require-kernel-config XFS_FS
require-kernel-config XFS_QUOTA XFS_POSIX_ACL XFS_RT XFS_ONLINE_SCRUB
require-kernel-config XFS_ONLINE_REPAIR XFS_DEBUG XFS_ASSERT_FATAL
require-kernel-config QUOTA

require-lib xfstests.sh

run_tests()
{
run_xfstests xfs "$@"
}

I think that's all you'll need to get going.