Boost.AFIO    Boost C++ Libraries
Classes | Public Types | Public Member Functions
boost::afio::utils::page_allocator< T > Class Template Reference

An STL allocator which allocates large TLB page memory.If the operating system is configured to allow it, this type of memory is particularly efficient for doing large scale file i/o. This is because the kernel must normally convert the scatter gather buffers you pass into extended scatter gather buffers as the memory you see as contiguous may not, and probably isn't, actually be contiguous in physical memory. Regions returned by this allocator may be allocated contiguously in physical memory and therefore the kernel can pass through your scatter gather buffers unmodified. More...

List of all members.

Classes

struct  rebind

Public Types

typedef T value_type
typedef T * pointer
typedef const T * const_pointer
typedef T & reference
typedef const T & const_reference
typedef size_t size_type
typedef ptrdiff_t difference_type
typedef std::true_type propagate_on_container_move_assignment
typedef std::true_type is_always_equal

Public Member Functions

template<class U >
 page_allocator (const page_allocator< U > &) noexcept
size_type max_size () const noexcept
pointer address (reference x) const noexcept
const_pointer address (const_reference x) const noexcept
pointer allocate (size_type n, const void *hint=0)
void deallocate (pointer p, size_type n)
template<class U , class... Args>
void construct (U *p, Args &&...args)
template<class U >
void destroy (U *p)

Detailed Description

template<typename T>
class boost::afio::utils::page_allocator< T >

An STL allocator which allocates large TLB page memory.

If the operating system is configured to allow it, this type of memory is particularly efficient for doing large scale file i/o. This is because the kernel must normally convert the scatter gather buffers you pass into extended scatter gather buffers as the memory you see as contiguous may not, and probably isn't, actually be contiguous in physical memory. Regions returned by this allocator may be allocated contiguously in physical memory and therefore the kernel can pass through your scatter gather buffers unmodified.

A particularly useful combination with this allocator is with the page_sizes() member function of __afio_dispatcher__. This will return which pages sizes are possible, and which page sizes are enabled for this user. If writing a file copy routine for example, using this allocator with the largest page size as the copy chunk makes a great deal of sense.

Be aware that as soon as the allocation exceeds a large page size, most systems allocate in multiples of the large page size, so if the large page size were 2Mb and you allocate 2Mb + 1 byte, 4Mb is actually consumed.

Definition at line 6231 of file afio.hpp.


January, 2014

Copyright © 2013-2014 Niall Douglas, Cork, Ireland
Copyright © 2013 Paul Kirth, California
Documentation is generated by Doxygen