mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Coding style fixes
This commit is contained in:
@@ -74,8 +74,9 @@ static inline CONSTEXPR uint my_bit_log2_size_t(size_t value)
|
||||
{
|
||||
#ifdef __cplusplus
|
||||
static_assert(sizeof(size_t) <= sizeof(ulonglong),
|
||||
"size_t <= ulonglong is an assumption that needs to be fixed for this architecture. "
|
||||
"Please create an issue on https://jira.mariadb.org");
|
||||
"size_t <= ulonglong is an assumption that needs to be fixed "
|
||||
"for this architecture. Please create an issue on "
|
||||
"https://jira.mariadb.org");
|
||||
#endif
|
||||
return my_bit_log2_uint64((ulonglong) value);
|
||||
}
|
||||
|
@@ -185,11 +185,11 @@ extern void my_get_large_page_size(void);
|
||||
|
||||
#ifdef HAVE_LARGE_PAGE_OPTION
|
||||
int my_init_large_pages(my_bool super_large_pages);
|
||||
uchar * my_large_malloc(size_t *size, myf my_flags);
|
||||
uchar *my_large_malloc(size_t *size, myf my_flags);
|
||||
void my_large_free(void *ptr, size_t size);
|
||||
#else
|
||||
#define my_large_malloc(A,B) my_malloc_lock(*(A),(B))
|
||||
#define my_large_free(A,B) my_free_lock((A))
|
||||
#define my_large_malloc(A, B) my_malloc_lock(*(A), (B))
|
||||
#define my_large_free(A, B) my_free_lock((A))
|
||||
#endif /* HAVE_LARGE_PAGE_OPTION */
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@@ -547,7 +547,8 @@ int init_simple_key_cache(SIMPLE_KEY_CACHE_CB *keycache,
|
||||
((size_t) blocks * keycache->key_cache_block_size) > use_mem && blocks > 8)
|
||||
blocks--;
|
||||
keycache->allocated_mem_size= blocks * keycache->key_cache_block_size;
|
||||
if ((keycache->block_mem=my_large_malloc(&keycache->allocated_mem_size, MYF(0))))
|
||||
if ((keycache->block_mem= my_large_malloc(&keycache->allocated_mem_size,
|
||||
MYF(0))))
|
||||
{
|
||||
/*
|
||||
Allocate memory for blocks, hash_links and hash entries;
|
||||
|
@@ -125,8 +125,9 @@ int my_init_large_pages(my_bool super_large_pages)
|
||||
my_get_large_page_sizes(my_large_page_sizes);
|
||||
if (!my_obtain_privilege(SE_LOCK_MEMORY_NAME))
|
||||
{
|
||||
fprintf(stderr, "mysqld: Lock Pages in memory access rights required for use with large-pages, "
|
||||
"see https://mariadb.com/kb/en/library/mariadb-memory-allocation/#huge-pages");
|
||||
fprintf(stderr, "mysqld: Lock Pages in memory access rights required for "
|
||||
"use with large-pages, see https://mariadb.com/kb/en/library/"
|
||||
"mariadb-memory-allocation/#huge-pages");
|
||||
return 1;
|
||||
}
|
||||
#ifdef HAVE_SOLARIS_LARGE_PAGES
|
||||
@@ -158,12 +159,12 @@ int my_init_large_pages(my_bool super_large_pages)
|
||||
mpss.mha_cmd= MHA_MAPSIZE_BSSBRK;
|
||||
mpss.mha_pagesize= max_page_size;
|
||||
mpss.mha_flags= 0;
|
||||
if (memcntl(NULL, 0, MC_HAT_ADVISE, (caddr_t)&mpss, 0, 0))
|
||||
if (memcntl(NULL, 0, MC_HAT_ADVISE, (caddr_t) &mpss, 0, 0))
|
||||
{
|
||||
perror("memcntl MC_HAT_ADVISE cmd MHA_MAPSIZE_BSSBRK error (continuing)");
|
||||
}
|
||||
mpss.mha_cmd= MHA_MAPSIZE_STACK;
|
||||
if (memcntl(NULL, 0, MC_HAT_ADVISE, (caddr_t)&mpss, 0, 0))
|
||||
if (memcntl(NULL, 0, MC_HAT_ADVISE, (caddr_t) &mpss, 0, 0))
|
||||
{
|
||||
perror("memcntl MC_HAT_ADVISE cmd MHA_MAPSIZE_STACK error (continuing)");
|
||||
}
|
||||
@@ -245,15 +246,15 @@ static void my_get_large_page_sizes(size_t sizes[my_large_page_sizes_length])
|
||||
}
|
||||
else
|
||||
{
|
||||
while (i < my_large_page_sizes_length &&
|
||||
(r= readdir(dirp)))
|
||||
while (i < my_large_page_sizes_length && (r= readdir(dirp)))
|
||||
{
|
||||
if (strncmp("hugepages-", r->d_name, 10) == 0)
|
||||
{
|
||||
sizes[i]= strtoull(r->d_name + 10, NULL, 10) * 1024ULL;
|
||||
if (!my_is_2pow(sizes[i]))
|
||||
{
|
||||
fprintf(stderr, "Warning: non-power of 2 large page size (%zu) found, skipping\n", sizes[i]);
|
||||
fprintf(stderr, "Warning: non-power of 2 large page size (%zu) found,"
|
||||
" skipping\n", sizes[i]);
|
||||
sizes[i]= 0;
|
||||
continue;
|
||||
}
|
||||
@@ -312,7 +313,8 @@ uchar* my_large_malloc_int(size_t *size, myf my_flags)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Warning: Failed to allocate %zu bytes from HugeTLB memory"
|
||||
"(page size %zu). errno %d\n", aligned_size, large_page_size, errno);
|
||||
"(page size %zu). errno %d\n", aligned_size, large_page_size,
|
||||
errno);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -332,11 +334,11 @@ uchar* my_large_malloc_int(size_t *size, myf my_flags)
|
||||
{
|
||||
if (large_page_size)
|
||||
{
|
||||
/*
|
||||
we do need to record the adjustment so that munmap gets called with
|
||||
the right size. This is only the case for HUGETLB pages.
|
||||
*/
|
||||
*size= aligned_size;
|
||||
/*
|
||||
we do need to record the adjustment so that munmap gets called with
|
||||
the right size. This is only the case for HUGETLB pages.
|
||||
*/
|
||||
*size= aligned_size;
|
||||
}
|
||||
DBUG_RETURN(ptr);
|
||||
}
|
||||
|
@@ -5042,8 +5042,10 @@ static int init_server_components()
|
||||
{"timed-mutexes", OPT_DEPRECATED_OPTION, "",
|
||||
0, 0, 0, GET_NO_ARG, OPT_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#if defined(__linux__)
|
||||
/* Linux was the only large page OS that we've now removed the (always)
|
||||
unused super-large-pages (because its Solaris only). */
|
||||
/*
|
||||
Linux was the only large page OS that we've now removed the (always)
|
||||
unused super-large-pages (because its Solaris only).
|
||||
*/
|
||||
{"super-large-pages", OPT_DEPRECATED_OPTION, "",
|
||||
0, 0, 0, GET_NO_ARG, OPT_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#endif
|
||||
|
@@ -28,7 +28,7 @@ Created 9/30/1995 Heikki Tuuri
|
||||
#include "univ.i"
|
||||
|
||||
/** The total amount of memory currently allocated from the operating
|
||||
system with os_mem_alloc_large(). */
|
||||
system with allocacte_large(). */
|
||||
Atomic_counter<ulint> os_total_large_mem_allocated;
|
||||
|
||||
/** Converts the current process id to a number.
|
||||
|
Reference in New Issue
Block a user