| 324 | } |
| 325 | |
| 326 | ceph::unique_leakable_ptr<buffer::raw> buffer::create_aligned_in_mempool( |
| 327 | unsigned len, unsigned align, int mempool) |
| 328 | { |
| 329 | // If alignment is a page multiple, use a separate buffer::raw to |
| 330 | // avoid fragmenting the heap. |
| 331 | // |
| 332 | // Somewhat unexpectedly, I see consistently better performance |
| 333 | // from raw_combined than from raw even when the allocation size is |
| 334 | // a page multiple (but alignment is not). |
| 335 | // |
| 336 | // I also see better performance from a separate buffer::raw once the |
| 337 | // size passes 8KB. |
| 338 | if ((align & ~CEPH_PAGE_MASK) == 0 || |
| 339 | len >= CEPH_PAGE_SIZE * 2) { |
| 340 | #ifndef __CYGWIN__ |
| 341 | return ceph::unique_leakable_ptr<buffer::raw>(new raw_posix_aligned(len, align)); |
| 342 | #else |
| 343 | return ceph::unique_leakable_ptr<buffer::raw>(new raw_hack_aligned(len, align)); |
| 344 | #endif |
| 345 | } |
| 346 | return raw_combined::create(len, align, mempool); |
| 347 | } |
| 348 | ceph::unique_leakable_ptr<buffer::raw> buffer::create_aligned( |
| 349 | unsigned len, unsigned align) { |
| 350 | return create_aligned_in_mempool(len, align, |