/** * Copyright (c) 2013 Mellanox Technologies, Inc. * All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow * * $HEADER$ */ #ifndef MCA_MEMHEAP_H #define MCA_MEMHEAP_H #include "opal/mca/mca.h" #include "oshmem/constants.h" #include "oshmem/proc/proc.h" #include "oshmem/mca/spml/spml.h" #define DEFAULT_SYMMETRIC_HEAP_SIZE 256 #define SIZE_IN_MEGA_BYTES(size_in_mb) size_in_mb * 1024 * 1024 BEGIN_C_DECLS struct mca_memheap_base_module_t; typedef struct memheap_context { void* user_base_addr; void* private_base_addr; size_t user_size; size_t private_size; } memheap_context_t; /** * Component initialize */ typedef struct mca_memheap_base_module_t* (*mca_memheap_base_component_init_fn_t)(memheap_context_t *, int *priority); /* * Symmetric heap allocation. Malloc like interface */ typedef int (*mca_memheap_base_module_alloc_fn_t)(size_t, void**); typedef int (*mca_memheap_base_module_memalign_fn_t)(size_t align, size_t size, void**); typedef int (*mca_memheap_base_module_realloc_fn_t)(size_t newsize, void *, void **); /* * Symmetric heap free. */ typedef int (*mca_memheap_base_module_free_fn_t)(void*); /** * Service functions */ typedef uint64_t (*mca_memheap_base_module_find_offset_fn_t)(int pe, int tr_id, void* va, void* rva); /** * @return mkey suitable to access pe via given transport id. rva is set to virtual address mapping of (va) * on remote pe. */ typedef mca_spml_mkey_t * (*mca_memheap_base_module_get_cached_mkey_fn_t)(int pe, void* va, int transport_id, void** rva); typedef mca_spml_mkey_t * (*mca_memheap_base_module_get_local_mkey_fn_t)(void* va, int transport_id); /* * Symmetric heap destructor. */ typedef int (*mca_memheap_base_module_finalize_fn_t)(void); typedef int (*mca_memheap_base_is_memheap_addr_fn_t)(const void* va); /* get mkeys from all ranks */ typedef void (*mca_memheap_base_mkey_exchange_fn_t)(void); /* * memheap component descriptor. Contains component version, information and * init functions */ struct mca_memheap_base_component_2_0_0_t { mca_base_component_t memheap_version; /**< version */ mca_base_component_data_t memheap_data; /**< metadata */ mca_memheap_base_component_init_fn_t memheap_init; /**