Measuring Memory Usage
Knowing how much memory a program allocates and possibly where the allocation happens is the first step to optimizing its memory use.
There are, fortunately, some easy-to-u...
Simulating CPU Caches
While the technical description of how a cache works is relatively easy to understand, it is not so easy to see how an actual program behaves with respect to(尊重) cache.
Prog...
Memory Performance Tools
A wide variety of tools is available to help programmers understand performance characteristics of a program, the cache and memory use among others.
Modern processors hav...
Explicit NUMA Optimizations
All the local memory and affinity rules cannot help out if all threads on all the nodes need access to the same memory regions.
It is, of course, possible to simply re...
Querying Node Information
The get_mempolicy interface can be used to query a variety of facts about the state of NUMA for a given address.
#include <numaif.h>
long get_mempolicy(int *policy...
Swapping and Policies
If physical memory runs out, the system has to drop clean pages and save dirty pages to swap.
The Linux swap implementation discards(丢弃) node information when it writes page...
Memory Policy
The idea behind defining a memory policy is to allow existing code to work reasonably well in a NUMA environment without major modifications.
The policy is inherited by child proces...
NUMA
For NUMA programming everything said so far about cache optimizations applies as well.
The differences only start below that level.
NUMA introduces different costs when accessing different ...