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: simplify Onode pin/unpin logic. #32852
Conversation
2186a13
to
dd34e97
Compare
This looks great! I think it's strictly better than the current master. Reviewing this made me realize one thing though that I missed before: currently (and with this PR), if you have an onode somewhere in the middle of the LRU, and you take and release a reference, we forget its LRU position. I'm not sure offhand if we have any really important callers that behave that way, but certainly things like scrub come to mind. I think what we want is something a bit more targetted at trimming: if trim encounters a pinned inode, only then does it change it to the pinned state. That way, when we put(), we can safely put it back at the tail of the LRU. And/or, we could even make _touch set a flag so that the unpin step puts it at the LRU top instead. What do you think? (Perhaps for later?) |
@ifed01 I haven't looked closely at this yet, but after a quick skim, does this go back to (potentially) scanning the entire onode list again during trim? That was exactly the problem the original PR was trying to address (though I question if it's worth the complexity at this point). |
@markhpc - no, this PR 'physically' removes pinned onode from cache while logically (i.e. corresponding 'cached' flag in onode is set) it's still their. And doesn't put pinned onode into pin_list but marks it with pinned flag instead. |
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.
Looks simpler to me. In terms of trimming, this keeps the unpinned onodes always at a maximum count, and lets pinned ones build up outside the cache. If there was a bug that ended up not unpinning things this could cause memory growth, but that seems unlikely.
In practice I think this will work well for the cache trimming + keeping memory use down, since the amount of pinned onodes should be small (related to in-flight I/O).
I like the validator function idea, it keeps the related code together nicely.
@liewegas I think we'd be better off addressing scrub or other background/single-use callers specifically by making them not cache (https://trello.com/c/3OZ417Si/516-bluestore-prevent-scrub-from-polluting-onode-cache) It'd be good to run this through some perf tests anyway to see if there's any detectable difference (I'm not sure whether the lack of lru position will matter in practice) |
Marking DNM/WIP as I can still see some occasional failures. |
Oh, getting them out of the cache entirely is quite clever! I will try to look at this more closely next week but that sounds excellent. |
dd34e97
to
9da3d0d
Compare
34e9f81
to
be070c7
Compare
This passed ceph_test_objectstore tests, so looks ready for final review. |
/a/sage-2020-02-01_20:59:41-rados-wip-sage-testing-2020-02-01-1055-distro-basic-smithi/4725021 |
also from ObjectStore/StoreTest.AttrSynthetic/2 |
This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days. |
This patch makes in/unpin logic more straightforward and hopefully safe in multi-threading. Also it eliminates Onode's pin_list as one doesn't need it to track pinned Onodes. OnodeCacheShard reference has been removed from onode too. cached/pinned flags have been introduced. They're accessed under cache lock hence original race has been totally addressed. Signed-off-by: Igor Fedotov <ifedotov@suse.com>
Onode pinning does the same for us. Signed-off-by: Igor Fedotov <ifedotov@suse.com>
This to be squashed with HEAD~2 later, left standalone to ease reviewing for now. Signed-off-by: Igor Fedotov <ifedotov@suse.com>
be070c7
to
0ef5ebc
Compare
Signed-off-by: Igor Fedotov <ifedotov@suse.com>
@tchaikov - would you give this another QA try, please? |
Signed-off-by: Igor Fedotov <ifedotov@suse.com>
Signed-off-by: Igor Fedotov <ifedotov@suse.com>
b82946f
to
aede2d5
Compare
jenkins test make check |
@tchaikov - honestly I don't understand what's broken in scrubbing if any. But I've made some changes so could you please give this PR another try? |
jenkins test make check |
jenkins test make check |
jenkins test make check |
This patch makes pin/unpin logic more straightforward and
hopefully safe in multi-threading.
Also it eliminates Onode's pin_list as one doesn't need it to track
pinned Onodes.
OnodeCacheShard reference has been removed from onode too.
cached/pinned flags have been introduced. They're accessed under cache lock
hence original race has been totally addressed.
Signed-off-by: Igor Fedotov ifedotov@suse.com
Checklist
Show available Jenkins commands
jenkins retest this please
jenkins test crimson perf
jenkins test signed
jenkins test make check
jenkins test make check arm64
jenkins test submodules
jenkins test dashboard
jenkins test dashboard backend
jenkins test docs
jenkins render docs
jenkins test ceph-volume all
jenkins test ceph-volume tox