aboutsummaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python/compaction-times.py
diff options
context:
space:
mode:
authorZheng Liu <[email protected]>2015-11-29 17:17:05 -0800
committerJens Axboe <[email protected]>2015-12-30 20:23:05 -0700
commit2ef9ccbfcb90cf84bdba320a571b18b05c41101b (patch)
tree46fb0b846580797b5b27494a594eb17160dfff56 /tools/perf/scripts/python/compaction-times.py
parent39fc8830eb96a559be8554b8df1e0c31f375feaf (diff)
bcache: fix a livelock when we cause a huge number of cache misses
Subject : [PATCH v2] bcache: fix a livelock in btree lock Date : Wed, 25 Feb 2015 20:32:09 +0800 (02/25/2015 04:32:09 AM) This commit tries to fix a livelock in bcache. This livelock might happen when we causes a huge number of cache misses simultaneously. When we get a cache miss, bcache will execute the following path. ->cached_dev_make_request() ->cached_dev_read() ->cached_lookup() ->bch->btree_map_keys() ->btree_root() <------------------------ ->bch_btree_map_keys_recurse() | ->cache_lookup_fn() | ->cached_dev_cache_miss() | ->bch_btree_insert_check_key() -| [If btree->seq is not equal to seq + 1, we should return EINTR and traverse btree again.] In bch_btree_insert_check_key() function we first need to check upgrade flag (op->lock == -1), and when this flag is true we need to release read btree->lock and try to take write btree->lock. During taking and releasing this write lock, btree->seq will be monotone increased in order to prevent other threads modify this in cache miss (see btree.h:74). But if there are some cache misses caused by some requested, we could meet a livelock because btree->seq is always changed by others. Thus no one can make progress. This commit will try to take write btree->lock if it encounters a race when we traverse btree. Although it sacrifice the scalability but we can ensure that only one can modify the btree. Signed-off-by: Zheng Liu <[email protected]> Tested-by: Joshua Schmid <[email protected]> Tested-by: Eric Wheeler <[email protected]> Cc: Joshua Schmid <[email protected]> Cc: Zhu Yanhai <[email protected]> Cc: Kent Overstreet <[email protected]> Cc: [email protected] Signed-off-by: Jens Axboe <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/compaction-times.py')
0 files changed, 0 insertions, 0 deletions