numa.h   numa.h 
skipping to change at line 55 skipping to change at line 55
{ {
mask->n[node / (8*sizeof(unsigned long))] |= mask->n[node / (8*sizeof(unsigned long))] |=
(1UL<<(node%(8*sizeof(unsigned long)))); (1UL<<(node%(8*sizeof(unsigned long))));
} }
static inline void nodemask_clr(nodemask_t *mask, int node) static inline void nodemask_clr(nodemask_t *mask, int node)
{ {
mask->n[node / (8*sizeof(unsigned long))] &= mask->n[node / (8*sizeof(unsigned long))] &=
~(1UL<<(node%(8*sizeof(unsigned long)))); ~(1UL<<(node%(8*sizeof(unsigned long))));
} }
static inline int nodemask_isset(nodemask_t *mask, int node) static inline int nodemask_isset(const nodemask_t *mask, int node)
{ {
if ((unsigned)node >= NUMA_NUM_NODES) if ((unsigned)node >= NUMA_NUM_NODES)
return 0; return 0;
if (mask->n[node / (8*sizeof(unsigned long))] & if (mask->n[node / (8*sizeof(unsigned long))] &
(1UL<<(node%(8*sizeof(unsigned long))))) (1UL<<(node%(8*sizeof(unsigned long)))))
return 1; return 1;
return 0; return 0;
} }
static inline int nodemask_equal(nodemask_t *a, nodemask_t *b) static inline int nodemask_equal(const nodemask_t *a, const nodemask_t *b)
{ {
int i; int i;
for (i = 0; i < NUMA_NUM_NODES/(sizeof(unsigned long)*8); i++) for (i = 0; i < NUMA_NUM_NODES/(sizeof(unsigned long)*8); i++)
if (a->n[i] != b->n[i]) if (a->n[i] != b->n[i])
return 0; return 0;
return 1; return 1;
} }
/* NUMA support available. If this returns a negative value all other funct ion /* NUMA support available. If this returns a negative value all other funct ion
in this library are undefined. */ in this library are undefined. */
skipping to change at line 83 skipping to change at line 83
/* NUMA support available. If this returns a negative value all other funct ion /* NUMA support available. If this returns a negative value all other funct ion
in this library are undefined. */ in this library are undefined. */
int numa_available(void); int numa_available(void);
/* Basic NUMA state */ /* Basic NUMA state */
/* Get max available node */ /* Get max available node */
int numa_max_node(void); int numa_max_node(void);
/* Return preferred node */ /* Return preferred node */
int numa_preferred(void); int numa_preferred(void);
/* Return node size and free memory */ /* Return node size and free memory */
long long numa_node_size64(int node, long long *freep);
long numa_node_size(int node, long *freep); long numa_node_size(int node, long *freep);
int numa_pagesize(void); int numa_pagesize(void);
/* Set with all nodes. Only valid after numa_available. */ /* Set with all nodes. Only valid after numa_available. */
extern nodemask_t numa_all_nodes; extern const nodemask_t numa_all_nodes;
/* Set with no nodes */ /* Set with no nodes */
extern nodemask_t numa_no_nodes; extern const nodemask_t numa_no_nodes;
/* Only run and allocate memory from a specific set of nodes. */ /* Only run and allocate memory from a specific set of nodes. */
void numa_bind(nodemask_t *nodes); void numa_bind(const nodemask_t *nodes);
/* Set the NUMA node interleaving mask. 0 to turn off interleaving */ /* Set the NUMA node interleaving mask. 0 to turn off interleaving */
void numa_set_interleave_mask(nodemask_t *nodemask); void numa_set_interleave_mask(const nodemask_t *nodemask);
/* Return the current interleaving mask */ /* Return the current interleaving mask */
nodemask_t numa_get_interleave_mask(void); nodemask_t numa_get_interleave_mask(void);
/* Some node to preferably allocate memory from for thread. */ /* Some node to preferably allocate memory from for thread. */
void numa_set_preferred(int node); void numa_set_preferred(int node);
/* Set local memory allocation policy for thread */ /* Set local memory allocation policy for thread */
void numa_set_localalloc(void); void numa_set_localalloc(void);
/* Only allocate memory from the nodes set in mask. 0 to turn off */ /* Only allocate memory from the nodes set in mask. 0 to turn off */
void numa_set_membind(nodemask_t *nodemask); void numa_set_membind(const nodemask_t *nodemask);
/* Return current membind */ /* Return current membind */
nodemask_t numa_get_membind(void); nodemask_t numa_get_membind(void);
int numa_get_interleave_node(void); int numa_get_interleave_node(void);
/* NUMA memory allocation. These functions always round to page size /* NUMA memory allocation. These functions always round to page size
and are relatively slow. */ and are relatively slow. */
/* Alloc memory page interleaved on nodes in mask */ /* Alloc memory page interleaved on nodes in mask */
void *numa_alloc_interleaved_subset(size_t size, nodemask_t *nodemask); void *numa_alloc_interleaved_subset(size_t size, const nodemask_t *nodemask );
/* Alloc memory page interleaved on all nodes. */ /* Alloc memory page interleaved on all nodes. */
void *numa_alloc_interleaved(size_t size); void *numa_alloc_interleaved(size_t size);
/* Alloc memory located on node */ /* Alloc memory located on node */
void *numa_alloc_onnode(size_t size, int node); void *numa_alloc_onnode(size_t size, int node);
/* Alloc memory on local node */ /* Alloc memory on local node */
void *numa_alloc_local(size_t size); void *numa_alloc_local(size_t size);
/* Allocation with current policy */ /* Allocation with current policy */
void *numa_alloc(size_t size); void *numa_alloc(size_t size);
/* Free memory allocated by the functions above */ /* Free memory allocated by the functions above */
void numa_free(void *mem, size_t size); void numa_free(void *mem, size_t size);
/* Low level functions, primarily for shared memory. All memory /* Low level functions, primarily for shared memory. All memory
processed by these must not be touched yet */ processed by these must not be touched yet */
/* Interleave an memory area. */ /* Interleave an memory area. */
void numa_interleave_memory(void *mem, size_t size, nodemask_t *mask); void numa_interleave_memory(void *mem, size_t size, const nodemask_t *mask) ;
/* Allocate a memory area on a specific node. */ /* Allocate a memory area on a specific node. */
void numa_tonode_memory(void *start, size_t size, int node); void numa_tonode_memory(void *start, size_t size, int node);
/* Allocate memory on a mask of nodes. */ /* Allocate memory on a mask of nodes. */
void numa_tonodemask_memory(void *mem, size_t size, nodemask_t *mask); void numa_tonodemask_memory(void *mem, size_t size, const nodemask_t *mask) ;
/* Allocate a memory area on the current node. */ /* Allocate a memory area on the current node. */
void numa_setlocal_memory(void *start, size_t size); void numa_setlocal_memory(void *start, size_t size);
/* Allocate memory area with current memory policy */ /* Allocate memory area with current memory policy */
void numa_police_memory(void *start, size_t size); void numa_police_memory(void *start, size_t size);
/* Run current thread only on nodes in mask */ /* Run current thread only on nodes in mask */
int numa_run_on_node_mask(nodemask_t *mask); int numa_run_on_node_mask(const nodemask_t *mask);
/* Run current thread only on node */ /* Run current thread only on node */
int numa_run_on_node(int node); int numa_run_on_node(int node);
/* Return current mask of nodes the thread can run on */ /* Return current mask of nodes the thread can run on */
nodemask_t numa_get_run_node_mask(void); nodemask_t numa_get_run_node_mask(void);
/* When strict fail allocation when memory cannot be allocated in target no de(s). */ /* When strict fail allocation when memory cannot be allocated in target no de(s). */
void numa_set_bind_policy(int strict); void numa_set_bind_policy(int strict);
/* Fail when existing memory has incompatible policy */ /* Fail when existing memory has incompatible policy */
void numa_set_strict(int flag); void numa_set_strict(int flag);
/* Convert node to CPU mask. -1/errno on failure, otherwise 0. */ /* Convert node to CPU mask. -1/errno on failure, otherwise 0. */
int numa_node_to_cpus(int node, unsigned long *buffer, int buffer_len); int numa_node_to_cpus(int node, unsigned long *buffer, int buffer_len);
/* Report distance of node1 from node2. 0 on error.*/
int numa_distance(int node1, int node2);
/* Error handling. */ /* Error handling. */
/* This is an internal function in libnuma that can be overwritten by an us er /* This is an internal function in libnuma that can be overwritten by an us er
program. Default is to print an error to stderr and exit if numa_exit_on _error program. Default is to print an error to stderr and exit if numa_exit_on _error
is true. */ is true. */
void numa_error(char *where); void numa_error(char *where);
/* When true exit the program when a NUMA system call (except numa_availabl e) /* When true exit the program when a NUMA system call (except numa_availabl e)
fails */ fails */
int numa_exit_on_error; extern int numa_exit_on_error;
/* Warning function. Can also be overwritten. Default is to print on stderr /* Warning function. Can also be overwritten. Default is to print on stderr
once. */ once. */
void numa_warn(int num, char *fmt, ...); void numa_warn(int num, char *fmt, ...);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif #endif
 End of changes. 16 change blocks. 
12 lines changed or deleted 18 lines changed or added


 numaif.h   numaif.h 
skipping to change at line 12 skipping to change at line 12
#define NUMAIF_H 1 #define NUMAIF_H 1
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/* Kernel interface for NUMA API */ /* Kernel interface for NUMA API */
/* System calls */ /* System calls */
extern long get_mempolicy(int *policy, extern long get_mempolicy(int *policy,
unsigned long *nmask, unsigned long maxnode, const unsigned long *nmask, unsigned long maxnode,
void *addr, int flags); void *addr, int flags);
extern long mbind(void *start, unsigned long len, int mode, extern long mbind(void *start, unsigned long len, int mode,
unsigned long *nmask, unsigned long maxnode, unsigned flag const unsigned long *nmask, unsigned long maxnode, unsigne
s); d flags);
extern long set_mempolicy(int mode, unsigned long *nmask, extern long set_mempolicy(int mode, const unsigned long *nmask,
unsigned long maxnode); unsigned long maxnode);
/* Policies */ /* Policies */
#define MPOL_DEFAULT 0 #define MPOL_DEFAULT 0
#define MPOL_PREFERRED 1 #define MPOL_PREFERRED 1
#define MPOL_BIND 2 #define MPOL_BIND 2
#define MPOL_INTERLEAVE 3 #define MPOL_INTERLEAVE 3
#define MPOL_MAX MPOL_INTERLEAVE #define MPOL_MAX MPOL_INTERLEAVE
 End of changes. 2 change blocks. 
4 lines changed or deleted 4 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/