On 16 Aug 2018, at 17:07, Liu Bo wrote:
The lock contention on btree nodes (esp. root node) is apparently a bottleneck when there're multiple readers and writers concurrently trying to access them. Unfortunately this is by design and it's not easy to fix it unless with some complex changes, however, there is still some room. With a stable workload based on fsmark which has 16 threads creating 1,600K files, we could see that a good amount of overhead comes from switching path between spinning mode and blocking mode in btrfs_search_slot(). Patch 1 provides more details about the overhead and test results from fsmark and dbench. Patch 2 kills leave_spinning due to the behaviour change from patch 1.
This is really interesting, do you have numbers about how often we are able to stay spinning?
IOW, do we end up blocking every time? -chris
