Re: [PATCH] mm: fix page_mkclean_one

From: Segher Boessenkool
Date: Thu Dec 28 2006 - 21:54:24 EST


I think what might be happening is that pdflush writes them out fine,
however we don't trap writes by the application _during_ that writeout.

Yeah. I believe that more exactly it happens if the very last
write to the page causes a writeback (due to dirty balancing)
while another writeback for the page is already happening.

As usual in these cases, I have zero proof.

It's something that will only occur with writeback and MAP_SHARED
writable access to the file pages.

It's the do_wp_page -> balance_dirty_pages -> generic_writepages
path for sure. Maybe it's enough to change

if (wbc->sync_mode != WB_SYNC_NONE)
wait_on_page_writeback(page);

if (PageWriteback(page) ||
!clear_page_dirty_for_io(page)) {
unlock_page(page);
continue;
}

to

if (wbc->sync_mode != WB_SYNC_NONE)
wait_on_page_writeback(page);

if (PageWriteback(page)) {
redirty_page_for_writepage(wbc, page);
unlock_page(page);
continue;
}

if (!clear_page_dirty_for_io(page)) {
unlock_page(page);
continue;
}

or something along those lines. Completely untested of course :-)


Segher

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/