Linux Kernel
3.7.1
|
#include <linux/bootmem.h>
#include <linux/memblock.h>
#include <linux/module.h>
#include "numa_internal.h"
Go to the source code of this file.
Macros | |
#define | LARGE_PAGE_BYTES (PTRS_PER_PTE * PAGE_SIZE) |
Functions | |
void | set_pmd_pfn (unsigned long vaddr, unsigned long pfn, pgprot_t flags) |
void * | alloc_remap (int nid, unsigned long size) |
void __init | init_alloc_remap (int nid, u64 start, u64 end) |
void __init | initmem_init (void) |
Variables | |
unsigned long | highend_pfn |
unsigned long | highstart_pfn |
#define LARGE_PAGE_BYTES (PTRS_PER_PTE * PAGE_SIZE) |
alloc_remap - Allocate remapped memory : NUMA node to allocate memory from : The size of allocation
Allocate bytes from the remap area of NUMA node . The size of the remap area is predetermined by init_alloc_remap() and only the callers considered there should call this function. For more info, please read the comment on top of init_alloc_remap().
The caller must be ready to handle allocation failure from this function and fall back to regular memory allocator in such cases.
CONTEXT: Single CPU early boot context.
RETURNS: Pointer to the allocated memory on success, NULL on failure.
init_alloc_remap - Initialize remap allocator for a NUMA node : NUMA node to initizlie remap allocator for
NUMA nodes may end up without any lowmem. As allocating pgdat and memmap on a different node with lowmem is inefficient, a special remap allocator is implemented which can be used by alloc_remap().
For each node, the amount of memory which will be necessary for pgdat and memmap is calculated and two memory areas of the size are allocated - one in the node and the other in lowmem; then, the area in the node is remapped to the lowmem area.
As pgdat and memmap must be allocated in lowmem anyway, this doesn't waste lowmem address space; however, the actual lowmem which gets remapped over is wasted. The amount shouldn't be problematic on machines this feature will be used.
Initialization failure isn't fatal. alloc_remap() is used opportunistically and the callers will fall back to other memory allocation mechanisms on failure.