Example #1
0
void *hbw_calloc(size_t num, size_t size)
{
    memkind_t kind;

    kind = hbw_get_kind(HBW_PAGESIZE_4KB);
    return memkind_calloc(kind, num, size);
}
Example #2
0
int hbw_posix_memalign(void **memptr, size_t alignment, size_t size)
{
    memkind_t kind;

    kind = hbw_get_kind(HBW_PAGESIZE_4KB);
    return memkind_posix_memalign(kind, memptr, alignment, size);
}
Example #3
0
int hbw_posix_memalign_psize(void **memptr, size_t alignment, size_t size,
                             int pagesize)
{
    memkind_t kind;
    int err = 0;

    kind = hbw_get_kind(pagesize);
    if (pagesize == HBW_PAGESIZE_1GB_STRICT &&
        size % 1073741824) {
        err = EINVAL;
    }
    if (!err) {
        err = memkind_posix_memalign(kind, memptr, alignment, size);
    }
    return err;
}
Example #4
0
void *hbw_realloc(void *ptr, size_t size)
{
    int i;
    memkind_t kind;
    memkind_t gbtlb_kinds[3] = {MEMKIND_HBW_GBTLB, MEMKIND_HBW_PREFERRED_GBTLB, MEMKIND_GBTLB};

    for (i = 0; i < 3; i++) {
        kind = gbtlb_kinds[i];
        if (kind->ops->check_addr(kind, ptr) == 0) {
            i = -1;
            break;
        }
    }
    if (i != -1) {
        kind = hbw_get_kind(HBW_PAGESIZE_4KB);
    }
    return memkind_realloc(kind, ptr, size);
}
Example #5
0
MEMKIND_EXPORT int hbw_posix_memalign_psize(void **memptr, size_t alignment, size_t size,
                             hbw_pagesize_t pagesize)
{
    if (pagesize == HBW_PAGESIZE_1GB_STRICT && size % (1 << 30)) {
        return EINVAL;
    }

    if((pagesize == HBW_PAGESIZE_2MB ||
        pagesize == HBW_PAGESIZE_1GB_STRICT ||
        pagesize == HBW_PAGESIZE_1GB) &&
        hbw_get_policy() == HBW_POLICY_INTERLEAVE) {

        log_err("HBW_POLICY_INTERLEAVE is unsupported with used page size!");
        return EINVAL;
    }

    return memkind_posix_memalign(hbw_get_kind(pagesize), memptr, alignment, size);
}
Example #6
0
MEMKIND_EXPORT void *hbw_realloc(void *ptr, size_t size)
{
    return memkind_realloc(hbw_get_kind(HBW_PAGESIZE_4KB), ptr, size);
}
Example #7
0
MEMKIND_EXPORT int hbw_posix_memalign(void **memptr, size_t alignment, size_t size)
{
    return memkind_posix_memalign(hbw_get_kind(HBW_PAGESIZE_4KB), memptr, alignment, size);
}
Example #8
0
MEMKIND_EXPORT void *hbw_calloc(size_t num, size_t size)
{
    return memkind_calloc(hbw_get_kind(HBW_PAGESIZE_4KB), num, size);
}