AFIO  v2.00 late alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
afio_v2_xxx::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...

#include "utils.hpp"

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 *=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 afio_v2_xxx::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.


The documentation for this class was generated from the following file: