]> git.karo-electronics.de Git - karo-tx-linux.git/commit
mm/filemap.c: avoid always dirtying mapping->flags on O_DIRECT
authorJens Axboe <axboe@fb.com>
Thu, 22 May 2014 00:42:19 +0000 (10:42 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 22 May 2014 00:42:19 +0000 (10:42 +1000)
commit9fa1e09dadd3b1f51c2ac307fa745de94a738f8f
tree18b13d5be830b9926b8d7e832acdacf5dae83459
parenteefc208fdaa3471a43babc2e4c14d36fc88c1d97
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>
mm/filemap.c