+ mm-filemapc-avoid-always-dirtying-mapping-flags-on-o_direct.patch added to -mm tree
Subsystems (2)
[email protected]
maintainerSubject: + mm-filemapc-avoid-always-dirtying-mapping-flags-on-o_direct.patch added to -mm tree
To: [email protected],[email protected],[email protected]
From: [email protected]
Date: Mon, 12 May 2014 16:07:02 -0700
The patch titled
Subject: mm/filemap.c: avoid always dirtying mapping->flags on O_DIRECT
has been added to the -mm tree. Its filename is
mm-filemapc-avoid-always-dirtying-mapping-flags-on-o_direct.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-filemapc-avoid-always-dirtying-mapping-flags-on-o_direct.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-filemapc-avoid-always-dirtying-mapping-flags-on-o_direct.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Jens Axboe <[email protected]>
Subject: 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.
---
mm/filemap.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
mm/filemap.c renamed from mm/filemap.c~mm-filemapc-avoid-always-dirtying-mapping-flags-on-o_direct +4 -2
@@ -257,9 +257,11 @@ static int filemap_check_errors(struct a {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; }
_
Patches currently in -mm which might be from [email protected] are
mm-filemapc-avoid-always-dirtying-mapping-flags-on-o_direct.patch linux-next.patch