diff --git a/Makefile.system b/Makefile.system index 840389db7..28c20453b 100644 --- a/Makefile.system +++ b/Makefile.system @@ -1590,7 +1590,7 @@ CCOMMON_OPT += -DFUNCTION_PROFILE endif ifdef HUGETLB_ALLOCATION -CCOMMON_OPT += -DALLOC_HUGETLB +CCOMMON_OPT += -DALLOC_HUGETLB -DALLOC_SHM endif ifdef HUGETLBFILE_ALLOCATION diff --git a/cmake/system.cmake b/cmake/system.cmake index 7166cc07f..3a78c9bd2 100644 --- a/cmake/system.cmake +++ b/cmake/system.cmake @@ -546,7 +546,7 @@ if (FUNCTION_PROFILE) endif () if (HUGETLB_ALLOCATION) - set(CCOMMON_OPT "${CCOMMON_OPT} -DALLOC_HUGETLB") + set(CCOMMON_OPT "${CCOMMON_OPT} -DALLOC_HUGETLB -DALLOC_SHM") endif () if (DEFINED HUGETLBFILE_ALLOCATION) diff --git a/driver/others/memory.c b/driver/others/memory.c index c55688ace..2a8ce78a9 100644 --- a/driver/others/memory.c +++ b/driver/others/memory.c @@ -964,7 +964,7 @@ static void *alloc_shm(void *address){ return map_address; } -#if defined OS_LINUX || defined OS_AIX || defined __sun__ || defined OS_WINDOWS +#if (defined ALLOC_HUGETLB) && (defined OS_LINUX || defined OS_AIX || defined __sun__ || defined OS_WINDOWS) static void alloc_hugetlb_free(struct alloc_t *alloc_info){ @@ -1166,12 +1166,12 @@ void *blas_memory_alloc(int procpos){ alloc_devicedirver, #endif /* Hugetlb implicitly assumes ALLOC_SHM */ +#if ((defined ALLOC_SHM) && (defined ALLOC_HUGETLB) && (defined OS_LINUX || defined OS_AIX || defined __sun__ || defined OS_WINDOWS)) + alloc_hugetlb, +#endif #ifdef ALLOC_SHM alloc_shm, #endif -#if ((defined ALLOC_SHM) && (defined OS_LINUX || defined OS_AIX || defined __sun__ || defined OS_WINDOWS)) - alloc_hugetlb, -#endif #ifdef ALLOC_MMAP alloc_mmap, #endif @@ -2534,7 +2534,7 @@ static void *alloc_shm(void *address){ return map_address; } -#if defined OS_LINUX || defined OS_AIX || defined __sun__ || defined OS_WINDOWS +#if (defined ALLOC_HUGETLB) && (defined OS_LINUX || defined OS_AIX || defined __sun__ || defined OS_WINDOWS) static void alloc_hugetlb_free(struct release_t *release){ @@ -2763,12 +2763,12 @@ void *blas_memory_alloc(int procpos){ alloc_devicedirver, #endif /* Hugetlb implicitly assumes ALLOC_SHM */ +#if ((defined ALLOC_SHM) && (defined ALLOC_HUGETLB) && (defined OS_LINUX || defined OS_AIX || defined __sun__ || defined OS_WINDOWS)) + alloc_hugetlb, +#endif #ifdef ALLOC_SHM alloc_shm, #endif -#if ((defined ALLOC_SHM) && (defined OS_LINUX || defined OS_AIX || defined __sun__ || defined OS_WINDOWS)) - alloc_hugetlb, -#endif #ifdef ALLOC_MMAP alloc_mmap, #endif @@ -2945,7 +2945,7 @@ void *blas_memory_alloc(int procpos){ } #endif -#if (defined ALLOC_SHM) && (defined OS_LINUX || defined OS_AIX || defined __sun__ || defined OS_WINDOWS) +#if ((defined ALLOC_SHM) && (defined ALLOC_HUGETLB) && (defined OS_LINUX || defined OS_AIX || defined __sun__ || defined OS_WINDOWS)) if ((*func == alloc_hugetlb) && (map_address != (void *)-1)) hugetlb_allocated = 1; #endif @@ -3061,7 +3061,7 @@ allocation2: } #endif -#if (defined ALLOC_SHM) && (defined OS_LINUX || defined OS_AIX || defined __sun__ || defined OS_WINDOWS) +#if ((defined ALLOC_SHM) && (defined ALLOC_HUGETLB) && (defined OS_LINUX || defined OS_AIX || defined __sun__ || defined OS_WINDOWS)) if ((*func == alloc_hugetlb) && (map_address != (void *)-1)) hugetlb_allocated = 1; #endif