linux-bcache.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dongsheng Yang <dongsheng.yang@easystack.cn>
To: Coly Li <colyli@suse.de>, Robert Pang <robertpang@google.com>,
	mingzhe.zou@easystack.cn
Cc: Bcache Linux <linux-bcache@vger.kernel.org>
Subject: Re: [PATCH v2] bcache: allow allocator to invalidate bucket in gc
Date: Wed, 8 May 2024 10:34:08 +0800	[thread overview]
Message-ID: <ea18e5b9-2d10-c459-ffec-fe7012fad345@easystack.cn> (raw)
In-Reply-To: <82DDC16E-F4BF-4F8D-8DB8-352D9A6D9AF5@suse.de>



在 2024/5/4 星期六 上午 11:08, Coly Li 写道:
> 
> 
>> 2024年5月4日 10:04,Robert Pang <robertpang@google.com> 写道:
>>
>> Hi Coly,
>>
>>> Can I know In which kernel version did you test the patch?
>>
>> I tested in both Linux kernels 5.10 and 6.1.
>>
>>> I didn’t observe obvious performance advantage of this patch.
>>
>> This patch doesn't improve bcache performance. Instead, it eliminates the IO stall in bcache that happens due to bch_allocator_thread() getting blocked and waiting on GC to finish when GC happens.
>>
>> /*
>> * We've run out of free buckets, we need to find some buckets
>> * we can invalidate. First, invalidate them in memory and add
>> * them to the free_inc list:
>> */
>> retry_invalidate:
>> allocator_wait(ca, ca->set->gc_mark_valid &&  <--------
>>         !ca->invalidate_needs_gc);
>> invalidate_buckets(ca);
>>
>>  From what you showed, it looks like your rebase is good. As you already noticed, the original patch was based on 4.x kernel so the bucket traversal in btree.c needs to be adapted for 5.x and 6.x kernels. I attached the patch rebased to 6.9 HEAD for your reference.
>>
>> But to observe the IO stall before the patch, please test with a read-write workload so GC will happen periodically enough (read-only or read-mostly workload doesn't show the problem). For me, I used the "fio" utility to generate a random read-write workload as follows.
>>
>> # Pre-generate a 900GB test file
>> $ truncate -s 900G test
>>
>> # Run random read-write workload for 1 hour
>> $ fio --time_based --runtime=3600s --ramp_time=2s --ioengine=libaio --name=latency_test --filename=test --bs=8k --iodepth=1 --size=900G  --readwrite=randrw --verify=0 --filename=fio --write_lat_log=lat --log_avg_msec=1000 --log_max_value=1
>>
>> We include the flags "--write_lat_log=lat --log_avg_msec=1000 --log_max_value=1" so fio will dump the second-by-second max latency into a log file at the end of test so we can when stall happens and for how long:
>>
> 
> Copied. Thanks for the information. Let me try the above command lines on my local machine with longer time.
> 
> 
> 
>> E.g.
>>
>> $ more lat_lat.1.log
>> (format: <time-ms>,<max-latency-ns>,,,)
>> ...
>> 777000, 5155548, 0, 0, 0
>> 778000, 105551, 1, 0, 0
>> 802615, 24276019570, 0, 0, 0 <---- stalls for 24s with no IO possible
>> 802615, 82134, 1, 0, 0
>> 804000, 9944554, 0, 0, 0
>> 805000, 7424638, 1, 0, 0
>>
>> I used a 375 GB local SSD (cache device) and a 1 TB network-attached storage (backing device). In the 1-hr run, GC starts happening about 10 minutes into the run and then happens at ~ 5 minute intervals. The stall duration ranges from a few seconds at the beginning to close to 40 seconds towards the end. Only about 1/2 to 2/3 of the cache is used by the end.
>>
>> Note that this patch doesn't shorten the GC either. Instead, it just avoids GC from blocking the allocator thread by first sweeping the buckets and marking reclaimable ones quickly at the beginning of GC so the allocator can proceed while GC continues its actual job.
>>
>> We are eagerly looking forward to this patch to be merged in this coming merge window that is expected to open in a week to two.
> 
> In order to avoid the no-space deadlock, normally there are around 10% space will not be allocated out. I need to look more close onto this patch.
> 
> 
> Dongsheng Yang,
> 
> Could you please post a new version based on current mainline kernel code ?

Hi Coly,
	Mingzhe will send a new version based on mainline.

Thanx
> 
> Thanks.
> 
> Coly Li
> 
> 
> 

  reply	other threads:[~2024-05-08 15:32 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-10 11:21 [PATCH] bcache: allow allocator to invalidate bucket in gc Dongsheng Yang
2020-09-10 11:28 ` [PATCH v2] " Dongsheng Yang
2020-09-18  9:53   ` Coly Li
2024-03-15 22:45     ` Robert Pang
2024-03-16  2:48       ` Coly Li
2024-03-17  5:41         ` Robert Pang
2024-03-17 13:59           ` Coly Li
2024-03-18  6:16             ` Robert Pang
2024-03-28 18:05               ` Robert Pang
2024-03-29 13:00                 ` Coly Li
2024-04-11  6:44                   ` Robert Pang
2024-05-03 18:23                     ` Coly Li
2024-05-03 18:28                       ` Coly Li
2024-05-04  2:04                         ` Robert Pang
2024-05-04  3:08                           ` Coly Li
2024-05-08  2:34                             ` Dongsheng Yang [this message]
2024-05-12  5:43                               ` Robert Pang
2024-05-12  9:41                                 ` Kernel error with 6.8.9 Pierre Juhen (IMAP)
2024-05-13  7:57                                   ` Coly Li
2024-05-17  0:34                                     ` Eric Wheeler
2024-05-17 15:57                                       ` Coly Li
2024-05-13  7:43                                 ` [PATCH v2] bcache: allow allocator to invalidate bucket in gc Coly Li
2024-05-14  5:15                                   ` Robert Pang
2024-05-14 23:39                                     ` Coly Li
2024-05-17  0:30                                       ` Eric Wheeler
2024-05-17 16:06                                         ` Coly Li
2024-05-17 21:47                                           ` Eric Wheeler
2024-05-24  7:14                                           ` Robert Pang
2024-05-27 18:14                                             ` Coly Li
2024-05-28  5:50                                               ` Robert Pang
2024-05-29 16:24                                                 ` Coly Li
2024-06-03  7:04                                                   ` Robert Pang

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=ea18e5b9-2d10-c459-ffec-fe7012fad345@easystack.cn \
    --to=dongsheng.yang@easystack.cn \
    --cc=colyli@suse.de \
    --cc=linux-bcache@vger.kernel.org \
    --cc=mingzhe.zou@easystack.cn \
    --cc=robertpang@google.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).