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

erasure-code: buffer alignment #2558

Closed
wants to merge 3 commits into from
Closed

erasure-code: buffer alignment #2558

wants to merge 3 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Sep 23, 2014

No description provided.

SIMD optimized erasure code computation needs aligned memory. Buffers
aligned to a page boundary are wasted on it though. The buffers used
for the erasure code computation are typical smaller than a page.

An alignment of 32 bytes is chosen to satisfy the needs of AVX/AVX2.
Could be made arch specific to reduce the alignment to 16 bytes for
arm/aarch64 NEON.

Signed-off-by: Janne Grunau <j@jannau.net>
Requiring page aligned buffers and realigning the input if necessary
creates measurable oberhead. ceph_erasure_code_benchmark is ~30% faster
with this change for technique=reed_sol_van,k=2,m=1.

Also prevents a misaligned buffer when bufferlist::c_str(bufferlist)
has to allocate a new buffer to provide continuous one. See bug #9408

Signed-off-by: Janne Grunau <j@jannau.net>
The benchmark is supposed to measure the encoding speed and not the
overhead of buffer realignments.

Signed-off-by: Janne Grunau <j@jannau.net>
{
std::list<ptr>::iterator p = _buffers.begin();
while (p != _buffers.end()) {
// keep anything that's already page sized+aligned
Copy link
Contributor

Choose a reason for hiding this comment

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

page sized?

Copy link
Author

Choose a reason for hiding this comment

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

leftover from the rebuild_page_aligned function from which it was copied

@liewegas
Copy link
Member

I think it would be tidier to make the alignment an argument to rebuild_aligned(n) is_aligned(n) and create_aligned(n). Unless that causes problems, in which case let's not hold this up...

@ghost
Copy link
Author

ghost commented Sep 26, 2014

For the record performance compared : http://tracker.ceph.com/issues/9601

@jannau
Copy link
Contributor

jannau commented Sep 29, 2014

I've fixed the copy-n-paste error in the comment and reworked the set to allow variable alignment. I don't see an immediate need for a variable alignment though. Unifying it with page_aligned code is probably worth it though,

@ghost
Copy link
Author

ghost commented Sep 29, 2014

jannau will open a new pull request with updated code

@ghost ghost closed this Sep 29, 2014
@ghost
Copy link
Author

ghost commented Sep 29, 2014

re-using the same pull request instead

@ghost ghost mentioned this pull request Sep 29, 2014
@ghost ghost added the core label Feb 19, 2016
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants