mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-11-14 18:36:34 +00:00
mm/filemap.c: avoid always dirtying mapping->flags on O_DIRECT
In some testing I ran today (some fio jobs that spread over two nodes),
we end up spending 40% of the time in filemap_check_errors(). That
smells fishy. Looking further, this is basically what happens:
blkdev_aio_read()
generic_file_aio_read()
filemap_write_and_wait_range()
if (!mapping->nr_pages)
filemap_check_errors()
and filemap_check_errors() always attempts two test_and_clear_bit() on
the mapping flags, thus dirtying it for every single invocation. The
patch below tests each of these bits before clearing them, avoiding this
issue. In my test case (4-socket box), performance went from 1.7M IOPS
to 4.0M IOPS.
Signed-off-by: Jens Axboe <axboe@fb.com>
Acked-by: Jeff Moyer <jmoyer@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
b985194c8c
commit
7fcbbaf183
1 changed files with 4 additions and 2 deletions
|
|
@ -257,9 +257,11 @@ static int filemap_check_errors(struct address_space *mapping)
|
|||
{
|
||||
int ret = 0;
|
||||
/* Check for outstanding write errors */
|
||||
if (test_and_clear_bit(AS_ENOSPC, &mapping->flags))
|
||||
if (test_bit(AS_ENOSPC, &mapping->flags) &&
|
||||
test_and_clear_bit(AS_ENOSPC, &mapping->flags))
|
||||
ret = -ENOSPC;
|
||||
if (test_and_clear_bit(AS_EIO, &mapping->flags))
|
||||
if (test_bit(AS_EIO, &mapping->flags) &&
|
||||
test_and_clear_bit(AS_EIO, &mapping->flags))
|
||||
ret = -EIO;
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue