I agree with that point that would hurts the performance and i removed the step of 1-3, please help to review. But the kind of situation you said should not appear. If we realloc a mem chunk to replace the first memory ptr with it when do claim_prepend every time the ptr of bufferslit will not exist bubbles except for the first ptr. 2017-09-18 16:57 GMT+08:00 kefu chai <tchaikov@xxxxxxxxx>: > On Mon, Sep 18, 2017 at 2:41 PM, 关云飞 <seven.guanyunfei@xxxxxxxxxx> wrote: >> >> hello kefu chai, >> >> >> These two days I carefully considered the pr https://github.com/ceph/ceph/pull/17661 and looked the code about bufferlist and I still think the steps of 1-3 >> is needed. Although the ptr::_off can guarantee bufferlist to be copied/read/decode/write_file rightly, this will lead a bufferlist not clean and will waste memory >> like picture below. >> >> Of course, it's also possible that i am not thinking about it, do you have any suggestions? > > i think it's the user of the bufferlist's choice to defrag the > element(s) in it or not. and it's not a pure win: it hurts the > performance in some cases. in the case of PR#17661, we are trying to > realloc a smaller mem chunk to replace the first memory ptr with it, > if it has "bubbles". what about the second element, or the third one > in the buffer::list, shall we also take care of them as well? > > -- > Regards > Kefu Chai > -- > To unsubscribe from this list: send the line "unsubscribe ceph-devel" in > the body of a message to majordomo@xxxxxxxxxxxxxxx > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html