Blame memkind-1.10.1/jemalloc/src/extent_mmap.c

Packit Service 7f3b24
#define JEMALLOC_EXTENT_MMAP_C_
Packit Service 7f3b24
#include "jemalloc/internal/jemalloc_preamble.h"
Packit Service 7f3b24
#include "jemalloc/internal/jemalloc_internal_includes.h"
Packit Service 7f3b24
Packit Service 7f3b24
#include "jemalloc/internal/assert.h"
Packit Service 7f3b24
#include "jemalloc/internal/extent_mmap.h"
Packit Service 7f3b24
Packit Service 7f3b24
/******************************************************************************/
Packit Service 7f3b24
/* Data. */
Packit Service 7f3b24
Packit Service 7f3b24
bool	opt_retain =
Packit Service 7f3b24
#ifdef JEMALLOC_RETAIN
Packit Service 7f3b24
    true
Packit Service 7f3b24
#else
Packit Service 7f3b24
    false
Packit Service 7f3b24
#endif
Packit Service 7f3b24
    ;
Packit Service 7f3b24
Packit Service 7f3b24
/******************************************************************************/
Packit Service 7f3b24
Packit Service 7f3b24
void *
Packit Service 7f3b24
extent_alloc_mmap(void *new_addr, size_t size, size_t alignment, bool *zero,
Packit Service 7f3b24
    bool *commit) {
Packit Service 7f3b24
	assert(alignment == ALIGNMENT_CEILING(alignment, PAGE));
Packit Service 7f3b24
	void *ret = pages_map(new_addr, size, alignment, commit);
Packit Service 7f3b24
	if (ret == NULL) {
Packit Service 7f3b24
		return NULL;
Packit Service 7f3b24
	}
Packit Service 7f3b24
	assert(ret != NULL);
Packit Service 7f3b24
	if (*commit) {
Packit Service 7f3b24
		*zero = true;
Packit Service 7f3b24
	}
Packit Service 7f3b24
	return ret;
Packit Service 7f3b24
}
Packit Service 7f3b24
Packit Service 7f3b24
bool
Packit Service 7f3b24
extent_dalloc_mmap(void *addr, size_t size) {
Packit Service 7f3b24
	if (!opt_retain) {
Packit Service 7f3b24
		pages_unmap(addr, size);
Packit Service 7f3b24
	}
Packit Service 7f3b24
	return opt_retain;
Packit Service 7f3b24
}