Thanks.Hi Guys, Eric: I got the parameters with this script, although I also checked / sys, doing the math everything is right. https://gist.github.com/damoxc/6267899 Thanks. Em segunda-feira, 8 de maio de 2023 às 21:42:26 BRT, Eric Wheeler <bcache@xxxxxxxxxxxxxxxxxx> escreveu: On Thu, 4 May 2023, Coly Li wrote: > > 2023年5月3日 04:34,Eric Wheeler <bcache@xxxxxxxxxxxxxxxxxx> 写道: > > > > On Thu, 20 Apr 2023, Adriano Silva wrote: > >> I continue to investigate the situation. There is actually a performance > >> gain when the bcache device is only half filled versus full. There is a > >> reduction and greater stability in the latency of direct writes and this > >> improves my scenario. > > > > Hi Coly, have you been able to look at this? > > > > This sounds like a great optimization and Adriano is in a place to test > > this now and report his findings. > > > > I think you said this should be a simple hack to add early reclaim, so > > maybe you can throw a quick patch together (even a rough first-pass with > > hard-coded reclaim values) > > > > If we can get back to Adriano quickly then he can test while he has an > > easy-to-reproduce environment. Indeed, this could benefit all bcache > > users. > > My current to-do list on hand is a little bit long. Yes I’d like and > plan to do it, but the response time cannot be estimated. I understand. Maybe I can put something together if you can provide some pointers since you are _the_ expert on bcache these days. Here are a few questions: Q's for Coly: - It looks like it could be a simple change to bch_allocator_thread(). Is this the right place? https://elixir.bootlin.com/linux/v6.3-rc5/source/drivers/md/bcache/alloc.c#L317 - On alloc.c:332 if (!fifo_pop(&ca->free_inc, bucket)) does it just need to be modified to something like this: if (!fifo_pop(&ca->free_inc, bucket) || total_unused_cache_percent() < 20) if so, where does bcache store the concept of "Total Unused Cache" ? - If I'm going about it wrong above, then where is the code path in bcache that frees a bucket such that it is completely unused (ie, as it was after `make-bcache -C`?) Q's Adriano: Where did you get these cache details from your earlier post? In /sys somewhere, probably, but I didn't find them: Total Cache Size 553.31GiB Total Cache Used 547.78GiB (99%) Total Unused Cache 5.53GiB (1%) Dirty Data 0B (0%) Evictable Cache 503.52GiB (91%) -- Eric Wheeler > > Coly Li > > [snipped]