aml.h 906 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
#ifndef AML_H
#define AML_H 1

#include<numa.h>
#include <stdlib.h>

/* An allocation.
 *
 * Contains information about an allocation.
 */
struct aml_node;
struct aml_alloc;

struct aml_alloc {
	void *start;
	size_t memsize;
	size_t blocksize;
	size_t numblocks;
	struct aml_node **nodemap;
};

struct aml_node {
23 24
	struct bitmask *mask;
	int numaid;
25 26 27 28 29
};

int aml_init(int *argc, char **argv[]);
int aml_finalize(void);

30
int aml_node_init(struct aml_node *, unsigned int);
31 32 33 34 35
int aml_node_destroy(struct aml_node *);

int aml_malloc(struct aml_alloc *, size_t, size_t, struct aml_node *);
int aml_free(struct aml_alloc *);

36 37 38 39 40 41 42 43
inline size_t aml_block_size(struct aml_alloc *a) {
	return a->blocksize;
}

int aml_block_address(struct aml_alloc *, size_t, void **);

int aml_block_move(struct aml_alloc *, size_t, struct aml_node *);
int aml_block_copy(struct aml_alloc *, size_t, struct aml_alloc *, size_t);
44
#endif