summaryrefslogtreecommitdiff
path: root/storage/innobase/os/os0proc.cc
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase/os/os0proc.cc')
-rw-r--r--storage/innobase/os/os0proc.cc31
1 files changed, 8 insertions, 23 deletions
diff --git a/storage/innobase/os/os0proc.cc b/storage/innobase/os/os0proc.cc
index 22966690ab0..7b8e4bde442 100644
--- a/storage/innobase/os/os0proc.cc
+++ b/storage/innobase/os/os0proc.cc
@@ -24,12 +24,7 @@ process control primitives
Created 9/30/1995 Heikki Tuuri
*******************************************************/
-#include "ha_prototypes.h"
-
-#include "os0proc.h"
-#include "srv0srv.h"
-#include "ut0mem.h"
-#include "ut0byte.h"
+#include "univ.i"
/* FreeBSD for example has only MAP_ANON, Linux has MAP_ANONYMOUS and
MAP_ANON but MAP_ANON is marked as deprecated */
@@ -41,7 +36,7 @@ MAP_ANON but MAP_ANON is marked as deprecated */
/** The total amount of memory currently allocated from the operating
system with os_mem_alloc_large(). */
-ulint os_total_large_mem_allocated = 0;
+Atomic_counter<ulint> os_total_large_mem_allocated;
/** Whether to use large pages in the buffer pool */
my_bool os_use_large_pages;
@@ -105,9 +100,7 @@ os_mem_alloc_large(
if (ptr) {
*n = size;
- my_atomic_addlint(
- &os_total_large_mem_allocated, size);
-
+ os_total_large_mem_allocated += size;
UNIV_MEM_ALLOC(ptr, size);
return(ptr);
}
@@ -132,8 +125,7 @@ skip:
ib::info() << "VirtualAlloc(" << size << " bytes) failed;"
" Windows error " << GetLastError();
} else {
- my_atomic_addlint(
- &os_total_large_mem_allocated, size);
+ os_total_large_mem_allocated += size;
UNIV_MEM_ALLOC(ptr, size);
}
#else
@@ -148,8 +140,7 @@ skip:
" errno " << errno;
ptr = NULL;
} else {
- my_atomic_addlint(
- &os_total_large_mem_allocated, size);
+ os_total_large_mem_allocated += size;
UNIV_MEM_ALLOC(ptr, size);
}
#endif
@@ -168,9 +159,7 @@ os_mem_free_large(
#if defined HAVE_LINUX_LARGE_PAGES && defined UNIV_LINUX
if (os_use_large_pages && os_large_page_size && !shmdt(ptr)) {
- my_atomic_addlint(
- &os_total_large_mem_allocated, -size);
- UNIV_MEM_FREE(ptr, size);
+ os_total_large_mem_allocated -= size;
return;
}
#endif /* HAVE_LINUX_LARGE_PAGES && UNIV_LINUX */
@@ -181,9 +170,7 @@ os_mem_free_large(
ib::error() << "VirtualFree(" << ptr << ", " << size
<< ") failed; Windows error " << GetLastError();
} else {
- my_atomic_addlint(
- &os_total_large_mem_allocated, -lint(size));
- UNIV_MEM_FREE(ptr, size);
+ os_total_large_mem_allocated -= size;
}
#elif !defined OS_MAP_ANON
ut_free(ptr);
@@ -196,9 +183,7 @@ os_mem_free_large(
ib::error() << "munmap(" << ptr << ", " << size << ") failed;"
" errno " << errno;
} else {
- my_atomic_addlint(
- &os_total_large_mem_allocated, -size);
- UNIV_MEM_FREE(ptr, size);
+ os_total_large_mem_allocated -= size;
}
#endif
}