Skip to content
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

osdc: reduce ObjectCacher's memory fragments #24297

Merged
merged 1 commit into from Oct 26, 2018
Merged

Conversation

ukernel
Copy link
Contributor

@ukernel ukernel commented Sep 27, 2018

Fixes: http://tracker.ceph.com/issues/36192
Signed-off-by: "Yan, Zheng" zyan@redhat.com

  • References tracker ticket
  • Updates documentation if necessary
  • Includes tests for new functionality or reproducer for bug

@ukernel ukernel added bug-fix cephfs Ceph File System labels Sep 27, 2018

uint64_t total = 0;
const raw *last = nullptr;
for (const auto r : raw_vec) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please note, if multiple ptrs are sharing the same raw buffer and they overlap with each other, we will underestimate the wasted space. as the length() takes the overlapped spaces into consideration. probably this does not happen in the usecase of ObjectCacher, it might be worthy to mention as a comment in this method though.

Copy link

@dillaman dillaman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it would be better to run maybe_rebuild_buffer in the split method since it would catch more waste corner cases.

@ukernel
Copy link
Contributor Author

ukernel commented Sep 28, 2018

you mean ObjectCacher::Object::split? that function split bufferlist, but the new bufferlists share the raw buffer

@dillaman
Copy link

dillaman commented Sep 28, 2018

@ukernel That's true, but the reason the split occurs is because one bufferlist is about to be (1) overwritten, (2) truncated, or (3) discarded. However, it's the piece that's not overwritten but is instead just split that concerns me in terms of wasted space and that piece could be denoted to split via a new check_wasted parameter.

For example, in RBD, a user can write 4 MiB at offset 0 and then later write 4 MiB at offset 512. The writex method receives the bh for the 512~4194304 case but the raw for the original 0~4194304 allocation really should be rebuilt down to the minimum page-size allocation.

BTW -- you can probably tag http://tracker.ceph.com/issues/20054 to this as well assuming it addresses the case above.

@ukernel
Copy link
Contributor Author

ukernel commented Sep 29, 2018

updated

@@ -454,15 +468,18 @@ ObjectCacher::BufferHead *ObjectCacher::Object::map_write(ObjectExtent &ex,
if (cur + max >= bh->end()) {
// we want right bit (one splice)
final = split(bh, cur); // just split it, take right half.
maybe_rebuild_buffer(bh);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: mismatched indentation in this function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. new code use tab. old code uses all whitespace.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ukernel Can we keep it consistent?

Fixes: http://tracker.ceph.com/issues/36192
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
Copy link

@dillaman dillaman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@dillaman
Copy link

@tchaikov @batrick any additional comments or can we flag this for needs qa?

@batrick
Copy link
Member

batrick commented Oct 18, 2018

@dillaman If you're happy with it then I am.

@tchaikov
Copy link
Contributor

tchaikov commented Oct 18, 2018

@dillaman fine by me. we just need to keep in mind that this PR breaks the client upgrade test. as it breaks the API/ABI. we will need to bump up the soversion before nautilus releases. sorry, false alarm.

@dillaman
Copy link

@dillaman fine by me. we just need to keep in mind that this PR breaks the client upgrade test. as it breaks the API/ABI. we will need to bump up the soversion before nautilus releases.

I'm probably missing something simple, but how does it break the ABI/API?

@tchaikov
Copy link
Contributor

sorry! no, it does not. i thought it changes an existing method. but apparently, i was wrong.

@batrick
Copy link
Member

batrick commented Oct 25, 2018

Didn't see any failures in the cephfs runs that would block merging this. @tchaikov merge when you're satisfied.

@dillaman
Copy link

@batrick @tchaikov I still need to run it through the RBD suite as well

@dillaman dillaman merged commit e5a166f into ceph:master Oct 26, 2018
@ukernel ukernel deleted the wip-36192 branch October 29, 2018 03:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants