All of lore.kernel.org
 help / color / mirror / Atom feed
From: ethanlien <ethanlien@synology.com>
To: dsterba@suse.cz, Ethan Lien <ethanlien@synology.com>,
	linux-btrfs@vger.kernel.org
Cc: linux-btrfs-owner@vger.kernel.org
Subject: Re: [PATCH] btrfs: use tagged writepage to mitigate livelock of snapshot
Date: Fri, 02 Nov 2018 15:13:13 +0800	[thread overview]
Message-ID: <d56ae2d1ac65a6e5f3cd1fd00b5f4784@synology.com> (raw)
In-Reply-To: <20181101180206.GU9136@twin.jikos.cz>

David Sterba 於 2018-11-02 02:02 寫到:
> On Thu, Nov 01, 2018 at 02:49:03PM +0800, Ethan Lien wrote:
>> Snapshot is expected to be fast. But if there are writers steadily
>> create dirty pages in our subvolume, the snapshot may take a very long
>> time to complete. To fix the problem, we use tagged writepage for 
>> snapshot
>> flusher as we do in the generic write_cache_pages(), so we can ommit 
>> pages
>> dirtied after the snapshot command.
>> 
>> We do a simple snapshot speed test on a Intel D-1531 box:
>> 
>> fio --ioengine=libaio --iodepth=32 --bs=4k --rw=write --size=64G
>> --direct=0 --thread=1 --numjobs=1 --time_based --runtime=120
>> --filename=/mnt/sub/testfile --name=job1 --group_reporting & sleep 5;
>> time btrfs sub snap -r /mnt/sub /mnt/snap; killall fio
>> 
>> original: 1m58sec
>> patched:  6.54sec
>> 
>> This is the best case for this patch since for a sequential write 
>> case,
>> we omit nearly all pages dirtied after the snapshot command.
>> 
>> For a multi writers, random write test:
>> 
>> fio --ioengine=libaio --iodepth=32 --bs=4k --rw=randwrite --size=64G
>> --direct=0 --thread=1 --numjobs=4 --time_based --runtime=120
>> --filename=/mnt/sub/testfile --name=job1 --group_reporting & sleep 5;
>> time btrfs sub snap -r /mnt/sub /mnt/snap; killall fio
>> 
>> original: 15.83sec
>> patched:  10.35sec
>> 
>> The improvement is less compared with the sequential write case, since
>> we omit only half of the pages dirtied after snapshot command.
>> 
>> Signed-off-by: Ethan Lien <ethanlien@synology.com>
> 
> This looks nice, thanks. I agree with the The suggestions from Nikolay,
> please update and resend.
> 
> I was bit curious about the 'livelock', what you describe does not seem
> to be one. System under heavy IO can make the snapshot dead slow but 
> can
> recover from that once the IO stops.

I'm not sure if this is indeed the case of 'livelock'. I learn the term 
from commit:
f446daaea9d4a420d, "mm: implement writeback livelock avoidance using 
page tagging".
If this is not the case, I can use another term.

> Regarding the sync semantics, there's AFAIK no change to the current
> state where the sync is done before snapshot but without further other
> guarantees. From that point I think it's safe to select only subset of
> pages and make things faster.
> 
> As the requested changes are not functional I'll add the patch to
> for-next for testing.


  reply	other threads:[~2018-11-02  7:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-01  6:49 [PATCH] btrfs: use tagged writepage to mitigate livelock of snapshot Ethan Lien
2018-11-01  8:59 ` Nikolay Borisov
2018-11-01  9:56   ` ethanlien
2018-11-01 10:01     ` Nikolay Borisov
2018-11-01 10:21       ` ethanlien
2018-11-01 13:24         ` Chris Mason
2018-11-01 11:57 ` Nikolay Borisov
2018-11-02  7:00   ` ethanlien
2018-11-01 18:02 ` David Sterba
2018-11-02  7:13   ` ethanlien [this message]
2018-11-02  8:43     ` Nikolay Borisov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d56ae2d1ac65a6e5f3cd1fd00b5f4784@synology.com \
    --to=ethanlien@synology.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs-owner@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.