Commit 4404ee29 authored by Sergey Vojtovich's avatar Sergey Vojtovich

MDEV-17441 - InnoDB transition to C++11 atomics

os_total_large_mem_allocated transition to Atomic_counter.
parent dab38ce0
......@@ -40,7 +40,7 @@ typedef unsigned long int os_process_id_t;
/** The total amount of memory currently allocated from the operating
system with os_mem_alloc_large(). */
extern ulint os_total_large_mem_allocated;
extern Atomic_counter<ulint> os_total_large_mem_allocated;
/** Whether to use large pages in the buffer pool */
extern my_bool os_use_large_pages;
......
......@@ -36,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;
......@@ -100,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);
}
......@@ -127,8 +125,7 @@ os_mem_alloc_large(
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
......@@ -143,8 +140,7 @@ os_mem_alloc_large(
" 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
......@@ -163,8 +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);
os_total_large_mem_allocated -= size;
UNIV_MEM_FREE(ptr, size);
return;
}
......@@ -176,8 +171,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));
os_total_large_mem_allocated -= size;
UNIV_MEM_FREE(ptr, size);
}
#elif !defined OS_MAP_ANON
......@@ -191,8 +185,7 @@ os_mem_free_large(
ib::error() << "munmap(" << ptr << ", " << size << ") failed;"
" errno " << errno;
} else {
my_atomic_addlint(
&os_total_large_mem_allocated, -size);
os_total_large_mem_allocated -= size;
UNIV_MEM_FREE(ptr, size);
}
#endif
......
......@@ -1329,7 +1329,7 @@ srv_printf_innodb_monitor(
fprintf(file,
"Total large memory allocated " ULINTPF "\n"
"Dictionary memory allocated " ULINTPF "\n",
os_total_large_mem_allocated,
ulint{os_total_large_mem_allocated},
dict_sys_get_size());
buf_print_io(file);
......
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