]> git.baikalelectronics.ru Git - kernel.git/commit
Fix page writeback thinko, causing Berkeley DB slowdown
authorNick Piggin <npiggin@suse.de>
Thu, 12 Feb 2009 03:34:23 +0000 (04:34 +0100)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 12 Feb 2009 16:10:53 +0000 (08:10 -0800)
commit4d736b9f7f24b1d1b6a33a084bf5751947eef648
tree5703cf8140e5b58f5f333dbbf7b1514404584e69
parentffe2ffa026f2f54b348c7946bdd3dc0e42646374
Fix page writeback thinko, causing Berkeley DB slowdown

A bug was introduced into write_cache_pages cyclic writeout by commit
82fcd0c57bcaa61af2188b0f57bfff9cfb8de338 ("mm: write_cache_pages cyclic
fix").  The intention (and comments) is that we should cycle back and
look for more dirty pages at the beginning of the file if there is no
more work to be done.

But the !done condition was dropped from the test.  This means that any
time the page writeout loop breaks (eg.  due to nr_to_write == 0), we
will set index to 0, then goto again.  This will set done_index to
index, then find done is set, so will proceed to the end of the
function.  When updating mapping->writeback_index for cyclic writeout,
we now use done_index == 0, so we're always cycling back to 0.

This seemed to be causing random mmap writes (slapadd and iozone) to
start writing more pages from the LRU and writeout would slowdown, and
caused bugzilla entry

http://bugzilla.kernel.org/show_bug.cgi?id=12604

about Berkeley DB slowing down dramatically.

With this patch, iozone random write performance is increased nearly
5x on my system (iozone -B -r 4k -s 64k -s 512m -s 1200m on ext2).

Signed-off-by: Nick Piggin <npiggin@suse.de>
Reported-and-tested-by: Jan Kara <jack@suse.cz>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/page-writeback.c