[dm-devel] [PATCH] dm writecache: fix performance degradation in ssd mode
J. Bruce Fields
bfields at redhat.com
Wed Jan 27 20:16:13 UTC 2021
Sorry for the delay testing:
On Sat, Jan 23, 2021 at 09:19:56AM -0500, Mikulas Patocka wrote:
> On Fri, 15 Jan 2021, J. Bruce Fields wrote:
>
> > Any recommendations? I spent some time with blktrace/blkparse/btt and
> > can't make head or tails of them, I'm afraid.
> >
> > --b.
>
> Hi
>
> Try this patch:
Looks good!
I applied this to Fedora's 5.10.7-200.fc33.x86_64 and timed an untar of
linux-5.9.tar.gz onto an NFS export of my dm-writecache setup and got
5m14s, where without the patch it took nearly 2 hours.
For comparison, the same untar took about 100 minutes to an export of
the backend hard drives, and 3m47s to an export of the caching device
(an Optane MEMPEK1W016GA).
I also looked again at a trace of an untar of the smaller nfs-utils
source, and saw that knfsd's vfs_sync_range()s were mainly returning in
a few hundred microseconds with the occasional latency of up to 3ms,
where before they frequently taking about 15ms.
(This is all nice because it means a $20 piece of hardware plus any old
hard drives can get me acceptable NFS server performance, whereas once
upon a time it would have required a drive array with battery-backed RAM
cache, or more recently an enterprise SSD with power loss protection).
Thanks for the persistence! (In both senses.)
--b.
> From: Mikulas Patocka <mpatocka at redhat.com>
>
> Fix a thinko in ssd_commit_superblock. region.count is in sectors, not
> bytes. This bug doesn't corrupt data, but it causes performance
> degradation.
>
> Signed-off-by: Mikulas Patocka <mpatocka at redhat.com>
> Fixes: dc8a01ae1dbd ("dm writecache: optimize superblock write")
> Cc: stable at vger.kernel.org # v5.7
> Reported-by: J. Bruce Fields <bfields at redhat.com>
>
> ---
> drivers/md/dm-writecache.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> Index: linux-2.6/drivers/md/dm-writecache.c
> ===================================================================
> --- linux-2.6.orig/drivers/md/dm-writecache.c 2021-01-23 10:51:31.000000000 +0100
> +++ linux-2.6/drivers/md/dm-writecache.c 2021-01-23 15:16:53.000000000 +0100
> @@ -523,7 +523,7 @@ static void ssd_commit_superblock(struct
>
> region.bdev = wc->ssd_dev->bdev;
> region.sector = 0;
> - region.count = PAGE_SIZE;
> + region.count = PAGE_SIZE >> SECTOR_SHIFT;
>
> if (unlikely(region.sector + region.count > wc->metadata_sectors))
> region.count = wc->metadata_sectors - region.sector;
More information about the dm-devel
mailing list