Skip to content

Commit f35f61b

Browse files
author
Jan Lindström
committed
Merge branch '10.2-numa' of https://github.com/grooverdan/mariadb-server into grooverdan-10.2-numa
2 parents 1de147f + f05dfbe commit f35f61b

File tree

13 files changed

+111
-10
lines changed

13 files changed

+111
-10
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ addons:
2828
- libpam0g-dev
2929
- libreadline-gplv2-dev
3030
- libssl-dev
31+
- libnuma-dev
3132
- lsb-release
3233
- perl
3334
- po-debconf

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ INCLUDE(install_macros)
162162
INCLUDE(systemd)
163163
INCLUDE(mysql_add_executable)
164164
INCLUDE(crc32-vpmsum)
165+
INCLUDE(numa)
165166

166167
# Handle options
167168
OPTION(DISABLE_SHARED

cmake/numa.cmake

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
MACRO (MYSQL_CHECK_NUMA)
2+
3+
CHECK_INCLUDE_FILES(numa.h HAVE_NUMA_H)
4+
CHECK_INCLUDE_FILES(numaif.h HAVE_NUMAIF_H)
5+
6+
IF(HAVE_NUMA_H AND HAVE_NUMAIF_H)
7+
OPTION(WITH_NUMA "Explicitly set NUMA memory allocation policy" ON)
8+
ELSE()
9+
OPTION(WITH_NUMA "Explicitly set NUMA memory allocation policy" OFF)
10+
ENDIF()
11+
12+
IF(WITH_NUMA AND HAVE_NUMA_H AND HAVE_NUMAIF_H)
13+
SET(SAVE_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
14+
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} numa)
15+
CHECK_C_SOURCE_COMPILES(
16+
"
17+
#include <numa.h>
18+
#include <numaif.h>
19+
int main()
20+
{
21+
struct bitmask *all_nodes= numa_all_nodes_ptr;
22+
set_mempolicy(MPOL_DEFAULT, 0, 0);
23+
return all_nodes != NULL;
24+
}"
25+
HAVE_LIBNUMA)
26+
SET(CMAKE_REQUIRED_LIBRARIES ${SAVE_CMAKE_REQUIRED_LIBRARIES})
27+
ELSE()
28+
SET(HAVE_LIBNUMA 0)
29+
ENDIF()
30+
31+
IF(WITH_NUMA AND NOT HAVE_LIBNUMA)
32+
# Forget it in cache, abort the build.
33+
UNSET(WITH_NUMA CACHE)
34+
MESSAGE(FATAL_ERROR "Could not find numa headers/libraries")
35+
ENDIF()
36+
37+
ENDMACRO()
38+

config.h.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@
106106
#cmakedefine HAVE_LIBWRAP 1
107107
#cmakedefine HAVE_SYSTEMD 1
108108
#cmakedefine HAVE_CRC32_VPMSUM 1
109+
#cmakedefine HAVE_LIBNUMA 1
109110

110111
/* Does "struct timespec" have a "sec" and "nsec" field? */
111112
#cmakedefine HAVE_TIMESPEC_TS_SEC 1

debian/control

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Build-Depends: bison,
1919
libreadline-gplv2-dev,
2020
libssl-dev,
2121
libxml2-dev,
22+
libnuma-dev,
2223
lsb-release,
2324
perl (>= 5.6.0),
2425
po-debconf,

mysql-test/include/have_numa.inc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
let $numa_support = `SELECT COUNT(VARIABLE_VALUE) = 1 FROM
2+
INFORMATION_SCHEMA.GLOBAL_VARIABLES
3+
WHERE VARIABLE_NAME='innodb_numa_interleave'`;
4+
5+
if ( $numa_support == 0 )
6+
{
7+
--skip Test requires: Binary must be built with NUMA support.
8+
}
9+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
SELECT @@GLOBAL.innodb_numa_interleave;
2+
@@GLOBAL.innodb_numa_interleave
3+
1
4+
SET @@GLOBAL.innodb_numa_interleave=off;
5+
ERROR HY000: Variable 'innodb_numa_interleave' is a read only variable
6+
SELECT @@GLOBAL.innodb_numa_interleave;
7+
@@GLOBAL.innodb_numa_interleave
8+
1
9+
SELECT @@SESSION.innodb_numa_interleave;
10+
ERROR HY000: Variable 'innodb_numa_interleave' is a GLOBAL variable
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--loose-innodb_numa_interleave=1
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
--source include/have_innodb.inc
2+
--source include/have_numa.inc
3+
--source include/have_64bit.inc
4+
5+
SELECT @@GLOBAL.innodb_numa_interleave;
6+
7+
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
8+
SET @@GLOBAL.innodb_numa_interleave=off;
9+
10+
SELECT @@GLOBAL.innodb_numa_interleave;
11+
12+
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
13+
SELECT @@SESSION.innodb_numa_interleave;
14+

storage/innobase/CMakeLists.txt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ MYSQL_CHECK_LZO()
3030
MYSQL_CHECK_LZMA()
3131
MYSQL_CHECK_BZIP2()
3232
MYSQL_CHECK_SNAPPY()
33+
MYSQL_CHECK_NUMA()
3334

3435
INCLUDE(innodb.cmake)
3536

@@ -173,11 +174,20 @@ IF(WITH_INNODB)
173174
SET(WITH_INNOBASE_STORAGE_ENGINE TRUE)
174175
ENDIF()
175176

177+
UNSET(NUMA_LIBRARY)
178+
IF(HAVE_LIBNUMA)
179+
SET(NUMA_LIBRARY "numa")
180+
ENDIF()
181+
176182
MYSQL_ADD_PLUGIN(innobase ${INNOBASE_SOURCES} STORAGE_ENGINE
177183
# MODULE_ONLY
178184
# MODULE_OUTPUT_NAME ha_innodb
179185
DEFAULT RECOMPILE_FOR_EMBEDDED
180-
LINK_LIBRARIES ${ZLIB_LIBRARY} ${CRC32_VPMSUM_LIBRARY} ${LINKER_SCRIPT})
186+
LINK_LIBRARIES
187+
${ZLIB_LIBRARY}
188+
${CRC32_VPMSUM_LIBRARY}
189+
${NUMA_LIBRARY}
190+
${LINKER_SCRIPT})
181191

182192
IF(WITH_INNOBASE_STORAGE_ENGINE)
183193
ADD_DEPENDENCIES(innobase GenError)

0 commit comments

Comments
 (0)