On Thu 16-04-20 15:01:28, Matthew Wilcox wrote: > From: "Matthew Wilcox (Oracle)" <willy@xxxxxxxxxxxxx> > > If this BUG() ever triggers, we'll have a dead system with no particular > information. Dumping the page will give us a fighting chance of debugging > the problem, and I think it's safe for us to just continue if we try > to clear the writeback bit on a page which already has the writeback > bit clear. > > Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> > --- > mm/filemap.c | 4 +--- > mm/page-writeback.c | 5 +++++ > 2 files changed, 6 insertions(+), 3 deletions(-) > > diff --git a/mm/filemap.c b/mm/filemap.c > index b7c5d2402370..401b24d980ba 100644 > --- a/mm/filemap.c > +++ b/mm/filemap.c > @@ -1293,9 +1293,7 @@ void end_page_writeback(struct page *page) > rotate_reclaimable_page(page); > } > > - if (!test_clear_page_writeback(page)) > - BUG(); > - > + test_clear_page_writeback(page); > smp_mb__after_atomic(); > wake_up_page(page, PG_writeback); > } > diff --git a/mm/page-writeback.c b/mm/page-writeback.c > index 7326b54ab728..ebaf0d8263a6 100644 > --- a/mm/page-writeback.c > +++ b/mm/page-writeback.c > @@ -2718,6 +2718,11 @@ int test_clear_page_writeback(struct page *page) > struct lruvec *lruvec; > int ret; > > + if (WARN_ON(!PageWriteback(page))) { > + dump_page(page, "!writeback"); > + return false; > + } > + WARN_ON_ONCE() here perhaps? I don't think dumping more pages will bring that much value... Honza -- Jan Kara <jack@xxxxxxxx> SUSE Labs, CR