Skip to contentSkip to conversation

Buffer alignment

DISCUSSION Loic Dachary 2 participants 3 messages Dec 10, 2013 – Dec 11, 2013

lore
Share & tools
lore
#0 lore raw

Hi Andreas,

In Ceph, buffers can be aligned if required using buffer::create_page_aligned

https://github.com/ceph/ceph/blob/master/src/common/buffer.cc#L519
https://github.com/ceph/ceph/blob/master/src/common/buffer.cc#L230

and although the Jerasure plugin has alignment requirements

https://github.com/ceph/ceph/blob/master/src/osd/ErasureCodePluginJerasure/ErasureCodeJerasure.cc#L79

it did not occur to me that aligning the buffers used to stored the encoded

https://github.com/ceph/ceph/blob/master/src/osd/ErasureCodePluginJerasure/ErasureCodeJerasure.cc#L87

result would be needed. For decoding the caller is responsible for allocating the buffers. For encoding it also is, except for the padding.

Do you think the API should recommend something regarding alignment ?

https://github.com/ceph/ceph/blob/master/src/osd/ErasureCodeInterface.h#L20

Cheers

Signature · 1 line
Loïc Dachary, Artisan Logiciel Libre
#1 lore raw

Hi Loic,
if you pull the BPC extension this requires 128-bit aligned memory adresses, maybe to prepare for future extensions they should be even 512-bit aligned. I can add an assertion if I see unaligned addresses.

Cheers Andreas.

________________________________________
From: Loic Dachary [[email protected]]
Sent: 10 December 2013 09:32
To: Andreas Joachim Peters
Cc: Ceph Development
Subject: Buffer alignment

Hi Andreas,

In Ceph, buffers can be aligned if required using buffer::create_page_aligned

https://github.com/ceph/ceph/blob/master/src/common/buffer.cc#L519
https://github.com/ceph/ceph/blob/master/src/common/buffer.cc#L230

and although the Jerasure plugin has alignment requirements

https://github.com/ceph/ceph/blob/master/src/osd/ErasureCodePluginJerasure/ErasureCodeJerasure.cc#L79

it did not occur to me that aligning the buffers used to stored the encoded

https://github.com/ceph/ceph/blob/master/src/osd/ErasureCodePluginJerasure/ErasureCodeJerasure.cc#L87

result would be needed. For decoding the caller is responsible for allocating the buffers. For encoding it also is, except for the padding.

Do you think the API should recommend something regarding alignment ?

https://github.com/ceph/ceph/blob/master/src/osd/ErasureCodeInterface.h#L20

Cheers

--
Loïc Dachary, Artisan Logiciel Libre

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 3 lines · Andreas Joachim Peters

Hi Loic,
if you pull the BPC extension this requires 128-bit aligned memory adresses, maybe to prepare for future extensions they should be even 512-bit aligned. I can add an assertion if I see unaligned addresses.

Could you please remind me which branch of your repository I should look at ?

Cheers

Quoted 40 lines

Cheers Andreas.

________________________________________
From: Loic Dachary [[email protected]]
Sent: 10 December 2013 09:32
To: Andreas Joachim Peters
Cc: Ceph Development
Subject: Buffer alignment

Hi Andreas,

In Ceph, buffers can be aligned if required using buffer::create_page_aligned

https://github.com/ceph/ceph/blob/master/src/common/buffer.cc#L519
https://github.com/ceph/ceph/blob/master/src/common/buffer.cc#L230

and although the Jerasure plugin has alignment requirements

https://github.com/ceph/ceph/blob/master/src/osd/ErasureCodePluginJerasure/ErasureCodeJerasure.cc#L79

it did not occur to me that aligning the buffers used to stored the encoded

https://github.com/ceph/ceph/blob/master/src/osd/ErasureCodePluginJerasure/ErasureCodeJerasure.cc#L87

result would be needed. For decoding the caller is responsible for allocating the buffers. For encoding it also is, except for the padding.

Do you think the API should recommend something regarding alignment ?

https://github.com/ceph/ceph/blob/master/src/osd/ErasureCodeInterface.h#L20

Cheers

--
Loïc Dachary, Artisan Logiciel Libre

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 1 line
Loïc Dachary, Artisan Logiciel Libre