Commit 10bca216 authored by kaa@polly.local's avatar kaa@polly.local

Fixed compilation for old Linux distributions that have no HugeTLB support

parent 3777af45
...@@ -532,7 +532,7 @@ os_mem_alloc_large( ...@@ -532,7 +532,7 @@ os_mem_alloc_large(
ibool assert_on_error) /* in: if TRUE, we crash mysqld if the memory ibool assert_on_error) /* in: if TRUE, we crash mysqld if the memory
cannot be allocated */ cannot be allocated */
{ {
#ifdef UNIV_LINUX #ifdef HAVE_LARGE_PAGES
ulint size; ulint size;
int shmid; int shmid;
void *ptr = NULL; void *ptr = NULL;
...@@ -542,6 +542,7 @@ os_mem_alloc_large( ...@@ -542,6 +542,7 @@ os_mem_alloc_large(
goto skip; goto skip;
} }
#ifdef UNIV_LINUX
/* Align block size to os_large_page_size */ /* Align block size to os_large_page_size */
size = ((n - 1) & ~(os_large_page_size - 1)) + os_large_page_size; size = ((n - 1) & ~(os_large_page_size - 1)) + os_large_page_size;
...@@ -561,6 +562,7 @@ os_mem_alloc_large( ...@@ -561,6 +562,7 @@ os_mem_alloc_large(
*/ */
shmctl(shmid, IPC_RMID, &buf); shmctl(shmid, IPC_RMID, &buf);
} }
#endif
if (ptr) { if (ptr) {
if (set_to_zero) { if (set_to_zero) {
...@@ -573,8 +575,8 @@ os_mem_alloc_large( ...@@ -573,8 +575,8 @@ os_mem_alloc_large(
} }
fprintf(stderr, "InnoDB HugeTLB: Warning: Using conventional memory pool\n"); fprintf(stderr, "InnoDB HugeTLB: Warning: Using conventional memory pool\n");
#endif
skip: skip:
#endif /* HAVE_LARGE_PAGES */
return(ut_malloc_low(n, set_to_zero, assert_on_error)); return(ut_malloc_low(n, set_to_zero, assert_on_error));
} }
...@@ -587,8 +589,12 @@ os_mem_free_large( ...@@ -587,8 +589,12 @@ os_mem_free_large(
/*=================*/ /*=================*/
void *ptr) /* in: number of bytes */ void *ptr) /* in: number of bytes */
{ {
#ifdef HAVE_LARGE_PAGES
if (os_use_large_pages && os_large_page_size
#ifdef UNIV_LINUX #ifdef UNIV_LINUX
if (os_use_large_pages && os_large_page_size && !shmdt(ptr)) { && !shmdt(ptr)
#endif
) {
return; return;
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment