New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
os/bluestore: narrow lock scope for cache trim() #10410
Conversation
2016-07-23 12:51:26.319710 7ff4dbc42680 1 bluestore(store_test_temp_dir) fsck finish with 0 errors [----------] Global test environment tear-down |
if (!o || !o->exists) | ||
r = false; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xiexingguo We can't do that cache->trim needs to be within collection lock as it is modifying onode structures..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Negative, cache->trim()
does cache cleanup only and is under its own mutex protection already.
We can't do that cache->trim needs to be within collection lock as it is modifying onode structures..
Otherwise shouldn't we promote to WLocker(c->lock)
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trim() does clear blob_map and onode_map. protecting against cache mutex is not good enough.
All the onode operations should be protected by collection lock. In this case, you are right, it should be promoted to Wlock at the time of clearing the onode structures..
BTW, I don't think taking write lock in the beginning instead of Rlock will be impacting performance much as the requests are been serialized within a PG (collection).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cache->lock protects the BufferSpace and OnodeSpace structures that get trimmed.
a35ba51
to
873ac5c
Compare
873ac5c
to
8adff5c
Compare
The cache trim() process can become be time consuming when the cache size is huge. Since it can be operated safely under its own internal mutex, we shall avoid to hold irrelevant locks when possible, which is good for performance. Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
8adff5c
to
9fd9296
Compare
lgtm |
@liewegas we saw a crash that Mark reported because the cache->trim() is not happening within c->lock() from _osr_reap_done(). The pull request #10578 seems to fix that. Am I missing anything ? |
trim should operate with only cache->lock, and any place where it affects a structure needs to be protected with cache->lock in the forward path (not the collection lock). |
The cache trim() process can become time consuming
when the cache size is huge. Since it can be operated
safely under its own internal mutex, we shall avoid
to hold irrelevant locks when possible, which is good
for performance.