Merge lp:~akopytov/percona-server/i26611-bug1059812-5.5 into lp:percona-server/5.5

Proposed by Alexey Kopytov
Status: Merged
Approved by: Laurynas Biveinis
Approved revision: no longer in the source branch.
Merged at revision: 330
Proposed branch: lp:~akopytov/percona-server/i26611-bug1059812-5.5
Merge into: lp:percona-server/5.5
Diff against target: 441 lines (+177/-10)
15 files modified
Percona-Server/mysql-test/r/percona_server_variables_debug.result (+1/-0)
Percona-Server/mysql-test/r/percona_server_variables_release.result (+1/-0)
Percona-Server/mysql-test/suite/sys_vars/r/innodb_buffer_pool_populate_basic.result (+12/-0)
Percona-Server/mysql-test/suite/sys_vars/t/innodb_buffer_pool_populate_basic-master.opt (+1/-0)
Percona-Server/mysql-test/suite/sys_vars/t/innodb_buffer_pool_populate_basic.test (+16/-0)
Percona-Server/scripts/mysqld_safe.sh (+68/-0)
Percona-Server/storage/innobase/buf/buf0buf.c (+7/-4)
Percona-Server/storage/innobase/handler/ha_innodb.cc (+7/-0)
Percona-Server/storage/innobase/include/buf0buf.h (+1/-0)
Percona-Server/storage/innobase/include/os0proc.h (+2/-1)
Percona-Server/storage/innobase/include/srv0srv.h (+1/-0)
Percona-Server/storage/innobase/os/os0proc.c (+55/-3)
Percona-Server/storage/innobase/row/row0merge.c (+1/-1)
Percona-Server/storage/innobase/srv/srv0srv.c (+2/-0)
Percona-Server/storage/innobase/srv/srv0start.c (+2/-1)
To merge this branch: bzr merge lp:~akopytov/percona-server/i26611-bug1059812-5.5
Reviewer Review Type Date Requested Status
Laurynas Biveinis (community) Approve
Davi Arnaut (community) Needs Fixing
Review via email: mp+130320@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Alexey Kopytov (akopytov) wrote :
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

Alexey -

It's really uncommon to see my_bool instead of ibool outside of handler/ and to lesser extent srv/. I would contain it to these two dirs by changing srv0start.c to

buf_pool_init (... srv_buf_pool_populate ? TRUE : FALSE, ... );

and making the rest of changes use ibool. I think that this horrible one line is still better than mixing bool types in the lower InnoDB subsystems.

The 2.6.23 version check is something I'd rather not see, but brief checking seems to show that this indeed the only way to find out if MAP_PRIVATE | MAP_POPULATE works :(

review: Needs Fixing
Revision history for this message
Jeremy Cole (jeremycole) wrote :

BTW, it seems that the get_time/set_time changes in sql/sp_head.cc and sql/sql_class.h are not related to the main bug being fixed here.

Revision history for this message
Davi Arnaut (davi) wrote :
review: Needs Fixing
Revision history for this message
Alexey Kopytov (akopytov) wrote :

Merged the bug fix, thanks!

Revision history for this message
Davi Arnaut (davi) wrote :

The my_bool/ibool cleanup suggestion is good, will take it.

Revision history for this message
Laurynas Biveinis (laurynas-biveinis) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Percona-Server/mysql-test/r/percona_server_variables_debug.result'
--- Percona-Server/mysql-test/r/percona_server_variables_debug.result 2012-10-12 06:24:13 +0000
+++ Percona-Server/mysql-test/r/percona_server_variables_debug.result 2012-10-18 18:03:21 +0000
@@ -88,6 +88,7 @@
88INNODB_AUTOINC_LOCK_MODE88INNODB_AUTOINC_LOCK_MODE
89INNODB_BLOCKING_BUFFER_POOL_RESTORE89INNODB_BLOCKING_BUFFER_POOL_RESTORE
90INNODB_BUFFER_POOL_INSTANCES90INNODB_BUFFER_POOL_INSTANCES
91INNODB_BUFFER_POOL_POPULATE
91INNODB_BUFFER_POOL_RESTORE_AT_STARTUP92INNODB_BUFFER_POOL_RESTORE_AT_STARTUP
92INNODB_BUFFER_POOL_SHM_CHECKSUM93INNODB_BUFFER_POOL_SHM_CHECKSUM
93INNODB_BUFFER_POOL_SHM_KEY94INNODB_BUFFER_POOL_SHM_KEY
9495
=== modified file 'Percona-Server/mysql-test/r/percona_server_variables_release.result'
--- Percona-Server/mysql-test/r/percona_server_variables_release.result 2012-09-28 01:36:45 +0000
+++ Percona-Server/mysql-test/r/percona_server_variables_release.result 2012-10-18 18:03:21 +0000
@@ -86,6 +86,7 @@
86INNODB_AUTOINC_LOCK_MODE86INNODB_AUTOINC_LOCK_MODE
87INNODB_BLOCKING_BUFFER_POOL_RESTORE87INNODB_BLOCKING_BUFFER_POOL_RESTORE
88INNODB_BUFFER_POOL_INSTANCES88INNODB_BUFFER_POOL_INSTANCES
89INNODB_BUFFER_POOL_POPULATE
89INNODB_BUFFER_POOL_RESTORE_AT_STARTUP90INNODB_BUFFER_POOL_RESTORE_AT_STARTUP
90INNODB_BUFFER_POOL_SHM_CHECKSUM91INNODB_BUFFER_POOL_SHM_CHECKSUM
91INNODB_BUFFER_POOL_SHM_KEY92INNODB_BUFFER_POOL_SHM_KEY
9293
=== added file 'Percona-Server/mysql-test/suite/sys_vars/r/innodb_buffer_pool_populate_basic.result'
--- Percona-Server/mysql-test/suite/sys_vars/r/innodb_buffer_pool_populate_basic.result 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/sys_vars/r/innodb_buffer_pool_populate_basic.result 2012-10-18 18:03:21 +0000
@@ -0,0 +1,12 @@
1CALL mtr.add_suppression(".* Forcing preallocation by faulting in pages.");
2SELECT @@GLOBAL.innodb_buffer_pool_populate;
3@@GLOBAL.innodb_buffer_pool_populate
41
51 Expected
6SET @@GLOBAL.innodb_buffer_pool_populate=0;
7ERROR HY000: Variable 'innodb_buffer_pool_populate' is a read only variable
8Expected error 'Read only variable'
9SELECT @@GLOBAL.innodb_buffer_pool_populate;
10@@GLOBAL.innodb_buffer_pool_populate
111
121 Expected
013
=== added file 'Percona-Server/mysql-test/suite/sys_vars/t/innodb_buffer_pool_populate_basic-master.opt'
--- Percona-Server/mysql-test/suite/sys_vars/t/innodb_buffer_pool_populate_basic-master.opt 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/sys_vars/t/innodb_buffer_pool_populate_basic-master.opt 2012-10-18 18:03:21 +0000
@@ -0,0 +1,1 @@
1--innodb-buffer-pool-populate=true
02
=== added file 'Percona-Server/mysql-test/suite/sys_vars/t/innodb_buffer_pool_populate_basic.test'
--- Percona-Server/mysql-test/suite/sys_vars/t/innodb_buffer_pool_populate_basic.test 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/sys_vars/t/innodb_buffer_pool_populate_basic.test 2012-10-18 18:03:21 +0000
@@ -0,0 +1,16 @@
1--source include/have_innodb.inc
2
3CALL mtr.add_suppression(".* Forcing preallocation by faulting in pages.");
4
5# Display current value of innodb_use_sys_malloc
6SELECT @@GLOBAL.innodb_buffer_pool_populate;
7--echo 1 Expected
8
9# Variable should be read-only
10--error ER_INCORRECT_GLOBAL_LOCAL_VAR
11SET @@GLOBAL.innodb_buffer_pool_populate=0;
12--echo Expected error 'Read only variable'
13
14SELECT @@GLOBAL.innodb_buffer_pool_populate;
15--echo 1 Expected
16
017
=== modified file 'Percona-Server/scripts/mysqld_safe.sh'
--- Percona-Server/scripts/mysqld_safe.sh 2011-11-10 13:46:51 +0000
+++ Percona-Server/scripts/mysqld_safe.sh 2012-10-18 18:03:21 +0000
@@ -17,6 +17,8 @@
17niceness=017niceness=0
18mysqld_ld_preload=18mysqld_ld_preload=
19mysqld_ld_library_path=19mysqld_ld_library_path=
20flush_caches=0
21numa_interleave=0
2022
21# Initial logging status: error log is not open, and not using syslog23# Initial logging status: error log is not open, and not using syslog
22logging=init24logging=init
@@ -60,6 +62,10 @@
60 --syslog Log messages to syslog with 'logger'62 --syslog Log messages to syslog with 'logger'
61 --skip-syslog Log messages to error log (default)63 --skip-syslog Log messages to error log (default)
62 --syslog-tag=TAG Pass -t "mysqld-TAG" to 'logger'64 --syslog-tag=TAG Pass -t "mysqld-TAG" to 'logger'
65 --flush-caches Flush and purge buffers/caches before
66 starting the server
67 --numa-interleave Run mysqld with its memory interleaved
68 on all NUMA nodes
6369
64All other options are passed to the mysqld program.70All other options are passed to the mysqld program.
6571
@@ -205,6 +211,8 @@
205 --skip-syslog) want_syslog=0 ;;211 --skip-syslog) want_syslog=0 ;;
206 --syslog-tag=*) syslog_tag="$val" ;;212 --syslog-tag=*) syslog_tag="$val" ;;
207 --timezone=*) TZ="$val"; export TZ; ;;213 --timezone=*) TZ="$val"; export TZ; ;;
214 --flush-caches) flush_caches=1 ;;
215 --numa-interleave) numa_interleave=1 ;;
208216
209 --help) usage ;;217 --help) usage ;;
210218
@@ -711,6 +719,41 @@
711fi719fi
712720
713#721#
722# Flush and purge buffers/caches.
723#
724
725if @TARGET_LINUX@ && test $flush_caches -eq 1
726then
727 # Locate sync, ensure it exists.
728 if ! my_which sync > /dev/null 2>&1
729 then
730 log_error "sync command not found, required for --flush-caches"
731 exit 1
732 # Flush file system buffers.
733 elif ! sync
734 then
735 # Huh, the sync() function is always successful...
736 log_error "sync failed, check if sync is properly installed"
737 fi
738
739 # Locate sysctl, ensure it exists.
740 if ! my_which sysctl > /dev/null 2>&1
741 then
742 log_error "sysctl command not found, required for --flush-caches"
743 exit 1
744 # Purge page cache, dentries and inodes.
745 elif ! sysctl -q -w vm.drop_caches=3
746 then
747 log_error "sysctl failed, check the error message for details"
748 exit 1
749 fi
750elif test $flush_caches -eq 1
751then
752 log_error "--flush-caches is not supported on this platform"
753 exit 1
754fi
755
756#
714# Uncomment the following lines if you want all tables to be automatically757# Uncomment the following lines if you want all tables to be automatically
715# checked and repaired during startup. You should add sensible key_buffer758# checked and repaired during startup. You should add sensible key_buffer
716# and sort_buffer values to my.cnf to improve check performance or require759# and sort_buffer values to my.cnf to improve check performance or require
@@ -730,6 +773,31 @@
730773
731cmd="`mysqld_ld_preload_text`$NOHUP_NICENESS"774cmd="`mysqld_ld_preload_text`$NOHUP_NICENESS"
732775
776#
777# Set mysqld's memory interleave policy.
778#
779
780if @TARGET_LINUX@ && test $numa_interleave -eq 1
781then
782 # Locate numactl, ensure it exists.
783 if ! my_which numactl > /dev/null 2>&1
784 then
785 log_error "numactl command not found, required for --numa-interleave"
786 exit 1
787 # Attempt to run a command, ensure it works.
788 elif ! numactl --interleave=all true
789 then
790 log_error "numactl failed, check if numactl is properly installed"
791 fi
792
793 # Launch mysqld with numactl.
794 cmd="$cmd numactl --interleave=all"
795elif test $numa_interleave -eq 1
796then
797 log_error "--numa-interleave is not supported on this platform"
798 exit 1
799fi
800
733for i in "$ledir/$MYSQLD" "$defaults" "--basedir=$MY_BASEDIR_VERSION" \801for i in "$ledir/$MYSQLD" "$defaults" "--basedir=$MY_BASEDIR_VERSION" \
734 "--datadir=$DATADIR" "--plugin-dir=$plugin_dir" "$USER_OPTION"802 "--datadir=$DATADIR" "--plugin-dir=$plugin_dir" "$USER_OPTION"
735do803do
736804
=== modified file 'Percona-Server/storage/innobase/buf/buf0buf.c'
--- Percona-Server/storage/innobase/buf/buf0buf.c 2012-10-12 06:24:13 +0000
+++ Percona-Server/storage/innobase/buf/buf0buf.c 2012-10-18 18:03:21 +0000
@@ -1028,7 +1028,8 @@
1028/*===========*/1028/*===========*/
1029 buf_pool_t* buf_pool, /*!< in: buffer pool instance */1029 buf_pool_t* buf_pool, /*!< in: buffer pool instance */
1030 buf_chunk_t* chunk, /*!< out: chunk of buffers */1030 buf_chunk_t* chunk, /*!< out: chunk of buffers */
1031 ulint mem_size) /*!< in: requested size in bytes */1031 ulint mem_size, /*!< in: requested size in bytes */
1032 ibool populate) /*!< in: virtual page preallocation */
1032{1033{
1033 buf_block_t* block;1034 buf_block_t* block;
1034 byte* frame;1035 byte* frame;
@@ -1044,7 +1045,7 @@
1044 + (UNIV_PAGE_SIZE - 1), UNIV_PAGE_SIZE);1045 + (UNIV_PAGE_SIZE - 1), UNIV_PAGE_SIZE);
10451046
1046 chunk->mem_size = mem_size;1047 chunk->mem_size = mem_size;
1047 chunk->mem = os_mem_alloc_large(&chunk->mem_size);1048 chunk->mem = os_mem_alloc_large(&chunk->mem_size, populate);
10481049
1049 if (UNIV_UNLIKELY(chunk->mem == NULL)) {1050 if (UNIV_UNLIKELY(chunk->mem == NULL)) {
10501051
@@ -1254,6 +1255,7 @@
1254/*===================*/1255/*===================*/
1255 buf_pool_t* buf_pool, /*!< in: buffer pool instance */1256 buf_pool_t* buf_pool, /*!< in: buffer pool instance */
1256 ulint buf_pool_size, /*!< in: size in bytes */1257 ulint buf_pool_size, /*!< in: size in bytes */
1258 ibool populate, /*!< in: virtual page preallocation */
1257 ulint instance_no) /*!< in: id of the instance */1259 ulint instance_no) /*!< in: id of the instance */
1258{1260{
1259 ulint i;1261 ulint i;
@@ -1286,7 +1288,7 @@
12861288
1287 UT_LIST_INIT(buf_pool->free);1289 UT_LIST_INIT(buf_pool->free);
12881290
1289 if (!buf_chunk_init(buf_pool, chunk, buf_pool_size)) {1291 if (!buf_chunk_init(buf_pool, chunk, buf_pool_size, populate)) {
1290 mem_free(chunk);1292 mem_free(chunk);
1291 mem_free(buf_pool);1293 mem_free(buf_pool);
12921294
@@ -1381,6 +1383,7 @@
1381buf_pool_init(1383buf_pool_init(
1382/*==========*/1384/*==========*/
1383 ulint total_size, /*!< in: size of the total pool in bytes */1385 ulint total_size, /*!< in: size of the total pool in bytes */
1386 ibool populate, /*!< in: virtual page preallocation */
1384 ulint n_instances) /*!< in: number of instances */1387 ulint n_instances) /*!< in: number of instances */
1385{1388{
1386 ulint i;1389 ulint i;
@@ -1398,7 +1401,7 @@
1398 for (i = 0; i < n_instances; i++) {1401 for (i = 0; i < n_instances; i++) {
1399 buf_pool_t* ptr = &buf_pool_ptr[i];1402 buf_pool_t* ptr = &buf_pool_ptr[i];
14001403
1401 if (buf_pool_init_instance(ptr, size, i) != DB_SUCCESS) {1404 if (buf_pool_init_instance(ptr, size, populate, i) != DB_SUCCESS) {
14021405
1403 /* Free all the instances created so far. */1406 /* Free all the instances created so far. */
1404 buf_pool_free(i);1407 buf_pool_free(i);
14051408
=== modified file 'Percona-Server/storage/innobase/handler/ha_innodb.cc'
--- Percona-Server/storage/innobase/handler/ha_innodb.cc 2012-10-01 00:49:13 +0000
+++ Percona-Server/storage/innobase/handler/ha_innodb.cc 2012-10-18 18:03:21 +0000
@@ -12494,6 +12494,12 @@
12494 "The size of the memory buffer InnoDB uses to cache data and indexes of its tables.",12494 "The size of the memory buffer InnoDB uses to cache data and indexes of its tables.",
12495 NULL, NULL, 128*1024*1024L, 32*1024*1024L, LONGLONG_MAX, 1024*1024L);12495 NULL, NULL, 128*1024*1024L, 32*1024*1024L, LONGLONG_MAX, 1024*1024L);
1249612496
12497static MYSQL_SYSVAR_BOOL(buffer_pool_populate, srv_buf_pool_populate,
12498 PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
12499 "Preallocate (pre-fault) the page frames required for the mapping "
12500 "established by the buffer pool memory region. Disabled by default.",
12501 NULL, NULL, FALSE);
12502
12497static MYSQL_SYSVAR_LONG(buffer_pool_instances, innobase_buffer_pool_instances,12503static MYSQL_SYSVAR_LONG(buffer_pool_instances, innobase_buffer_pool_instances,
12498 PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,12504 PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
12499 "Number of buffer pool instances, set to higher value on high-end machines to increase scalability",12505 "Number of buffer pool instances, set to higher value on high-end machines to increase scalability",
@@ -12874,6 +12880,7 @@
12874 MYSQL_SYSVAR(additional_mem_pool_size),12880 MYSQL_SYSVAR(additional_mem_pool_size),
12875 MYSQL_SYSVAR(autoextend_increment),12881 MYSQL_SYSVAR(autoextend_increment),
12876 MYSQL_SYSVAR(buffer_pool_size),12882 MYSQL_SYSVAR(buffer_pool_size),
12883 MYSQL_SYSVAR(buffer_pool_populate),
12877 MYSQL_SYSVAR(buffer_pool_instances),12884 MYSQL_SYSVAR(buffer_pool_instances),
12878 MYSQL_SYSVAR(buffer_pool_shm_key),12885 MYSQL_SYSVAR(buffer_pool_shm_key),
12879 MYSQL_SYSVAR(buffer_pool_shm_checksum),12886 MYSQL_SYSVAR(buffer_pool_shm_checksum),
1288012887
=== modified file 'Percona-Server/storage/innobase/include/buf0buf.h'
--- Percona-Server/storage/innobase/include/buf0buf.h 2012-08-07 06:10:00 +0000
+++ Percona-Server/storage/innobase/include/buf0buf.h 2012-10-18 18:03:21 +0000
@@ -233,6 +233,7 @@
233buf_pool_init(233buf_pool_init(
234/*=========*/234/*=========*/
235 ulint size, /*!< in: Size of the total pool in bytes */235 ulint size, /*!< in: Size of the total pool in bytes */
236 ibool populate, /*!< in: Force virtual page preallocation */
236 ulint n_instances); /*!< in: Number of instances */237 ulint n_instances); /*!< in: Number of instances */
237/********************************************************************//**238/********************************************************************//**
238Frees the buffer pool at shutdown. This must not be invoked before239Frees the buffer pool at shutdown. This must not be invoked before
239240
=== modified file 'Percona-Server/storage/innobase/include/os0proc.h'
--- Percona-Server/storage/innobase/include/os0proc.h 2010-06-22 15:58:28 +0000
+++ Percona-Server/storage/innobase/include/os0proc.h 2012-10-18 18:03:21 +0000
@@ -58,7 +58,8 @@
58void*58void*
59os_mem_alloc_large(59os_mem_alloc_large(
60/*===============*/60/*===============*/
61 ulint* n); /*!< in/out: number of bytes */61 ulint* n, /*!< in/out: number of bytes */
62 ibool populate); /*!< in: virtual page preallocation */
62/****************************************************************//**63/****************************************************************//**
63Frees large pages memory. */64Frees large pages memory. */
64UNIV_INTERN65UNIV_INTERN
6566
=== modified file 'Percona-Server/storage/innobase/include/srv0srv.h'
--- Percona-Server/storage/innobase/include/srv0srv.h 2012-09-28 07:53:51 +0000
+++ Percona-Server/storage/innobase/include/srv0srv.h 2012-10-18 18:03:21 +0000
@@ -179,6 +179,7 @@
179extern ibool srv_use_sys_malloc;179extern ibool srv_use_sys_malloc;
180#endif /* UNIV_HOTBACKUP */180#endif /* UNIV_HOTBACKUP */
181extern ulint srv_buf_pool_size; /*!< requested size in bytes */181extern ulint srv_buf_pool_size; /*!< requested size in bytes */
182extern my_bool srv_buf_pool_populate; /*!< virtual page preallocation */
182extern ulint srv_buf_pool_instances; /*!< requested number of buffer pool instances */183extern ulint srv_buf_pool_instances; /*!< requested number of buffer pool instances */
183extern ulint srv_buf_pool_old_size; /*!< previously requested size */184extern ulint srv_buf_pool_old_size; /*!< previously requested size */
184extern ulint srv_buf_pool_curr_size; /*!< current size in bytes */185extern ulint srv_buf_pool_curr_size; /*!< current size in bytes */
185186
=== modified file 'Percona-Server/storage/innobase/os/os0proc.c'
--- Percona-Server/storage/innobase/os/os0proc.c 2011-12-28 10:31:18 +0000
+++ Percona-Server/storage/innobase/os/os0proc.c 2012-10-18 18:03:21 +0000
@@ -32,6 +32,12 @@
32#include "ut0mem.h"32#include "ut0mem.h"
33#include "ut0byte.h"33#include "ut0byte.h"
3434
35/* Linux release version */
36#if defined(UNIV_LINUX) && defined(_GNU_SOURCE)
37#include <string.h> /* strverscmp() */
38#include <sys/utsname.h> /* uname() */
39#endif
40
35/* FreeBSD for example has only MAP_ANON, Linux has MAP_ANONYMOUS and41/* FreeBSD for example has only MAP_ANON, Linux has MAP_ANONYMOUS and
36MAP_ANON but MAP_ANON is marked as deprecated */42MAP_ANON but MAP_ANON is marked as deprecated */
37#if defined(MAP_ANONYMOUS)43#if defined(MAP_ANONYMOUS)
@@ -40,6 +46,13 @@
40#define OS_MAP_ANON MAP_ANON46#define OS_MAP_ANON MAP_ANON
41#endif47#endif
4248
49/* Linux's MAP_POPULATE */
50#if defined(MAP_POPULATE)
51#define OS_MAP_POPULATE MAP_POPULATE
52#else
53#define OS_MAP_POPULATE 0
54#endif
55
43UNIV_INTERN ibool os_use_large_pages;56UNIV_INTERN ibool os_use_large_pages;
44/* Large page size. This may be a boot-time option on some platforms */57/* Large page size. This may be a boot-time option on some platforms */
45UNIV_INTERN ulint os_large_page_size;58UNIV_INTERN ulint os_large_page_size;
@@ -63,13 +76,32 @@
63}76}
6477
65/****************************************************************//**78/****************************************************************//**
79Retrieve and compare operating system release.
80@return TRUE if the OS release is equal to, or later than release. */
81UNIV_INTERN
82ibool
83os_compare_release(
84/*===============*/
85 const char* release /*!< in: OS release */
86 __attribute__((unused)))
87{
88#if defined(UNIV_LINUX) && defined(_GNU_SOURCE)
89 struct utsname name;
90 return uname(&name) == 0 && strverscmp(name.release, release) >= 0;
91#else
92 return 0;
93#endif
94}
95
96/****************************************************************//**
66Allocates large pages memory.97Allocates large pages memory.
67@return allocated memory */98@return allocated memory */
68UNIV_INTERN99UNIV_INTERN
69void*100void*
70os_mem_alloc_large(101os_mem_alloc_large(
71/*===============*/102/*===============*/
72 ulint* n) /*!< in/out: number of bytes */103 ulint* n, /*!< in/out: number of bytes */
104 ibool populate) /*!< in: virtual page preallocation */
73{105{
74 void* ptr;106 void* ptr;
75 ulint size;107 ulint size;
@@ -155,12 +187,13 @@
155 ut_ad(ut_is_2pow(size));187 ut_ad(ut_is_2pow(size));
156 size = *n = ut_2pow_round(*n + (size - 1), size);188 size = *n = ut_2pow_round(*n + (size - 1), size);
157 ptr = mmap(NULL, size, PROT_READ | PROT_WRITE,189 ptr = mmap(NULL, size, PROT_READ | PROT_WRITE,
158 MAP_PRIVATE | OS_MAP_ANON, -1, 0);190 MAP_PRIVATE | OS_MAP_ANON |
191 (populate ? OS_MAP_POPULATE : 0), -1, 0);
159 if (UNIV_UNLIKELY(ptr == (void*) -1)) {192 if (UNIV_UNLIKELY(ptr == (void*) -1)) {
160 fprintf(stderr, "InnoDB: mmap(%lu bytes) failed;"193 fprintf(stderr, "InnoDB: mmap(%lu bytes) failed;"
161 " errno %lu\n",194 " errno %lu\n",
162 (ulong) size, (ulong) errno);195 (ulong) size, (ulong) errno);
163 ptr = NULL;196 return(NULL);
164 } else {197 } else {
165 os_fast_mutex_lock(&ut_list_mutex);198 os_fast_mutex_lock(&ut_list_mutex);
166 ut_total_allocated_memory += size;199 ut_total_allocated_memory += size;
@@ -168,6 +201,25 @@
168 UNIV_MEM_ALLOC(ptr, size);201 UNIV_MEM_ALLOC(ptr, size);
169 }202 }
170#endif203#endif
204
205#if OS_MAP_ANON && OS_MAP_POPULATE
206 /* MAP_POPULATE is only supported for private mappings
207 since Linux 2.6.23. */
208 populate = populate && !os_compare_release("2.6.23");
209
210 if (populate) {
211 fprintf(stderr, "InnoDB: Warning: mmap(MAP_POPULATE) "
212 "is not supported for private mappings. "
213 "Forcing preallocation by faulting in pages.\n");
214 }
215#endif
216
217 /* Initialize the entire buffer to force the allocation
218 of physical memory page frames. */
219 if (populate) {
220 memset(ptr, '\0', size);
221 }
222
171 return(ptr);223 return(ptr);
172}224}
173225
174226
=== modified file 'Percona-Server/storage/innobase/row/row0merge.c'
--- Percona-Server/storage/innobase/row/row0merge.c 2012-07-13 11:34:09 +0000
+++ Percona-Server/storage/innobase/row/row0merge.c 2012-10-18 18:03:21 +0000
@@ -2720,7 +2720,7 @@
27202720
2721 merge_files = mem_alloc(n_indexes * sizeof *merge_files);2721 merge_files = mem_alloc(n_indexes * sizeof *merge_files);
2722 block_size = 3 * merge_sort_block_size;2722 block_size = 3 * merge_sort_block_size;
2723 block_mem = os_mem_alloc_large(&block_size);2723 block_mem = os_mem_alloc_large(&block_size, FALSE);
27242724
2725 for (i = 0; i < UT_ARR_SIZE(block); i++) {2725 for (i = 0; i < UT_ARR_SIZE(block); i++) {
2726 block[i] = (row_merge_block_t ) ((byte *) block_mem +2726 block[i] = (row_merge_block_t ) ((byte *) block_mem +
27272727
=== modified file 'Percona-Server/storage/innobase/srv/srv0srv.c'
--- Percona-Server/storage/innobase/srv/srv0srv.c 2012-09-28 07:53:51 +0000
+++ Percona-Server/storage/innobase/srv/srv0srv.c 2012-10-18 18:03:21 +0000
@@ -232,6 +232,8 @@
232UNIV_INTERN my_bool srv_use_sys_malloc = TRUE;232UNIV_INTERN my_bool srv_use_sys_malloc = TRUE;
233/* requested size in kilobytes */233/* requested size in kilobytes */
234UNIV_INTERN ulint srv_buf_pool_size = ULINT_MAX;234UNIV_INTERN ulint srv_buf_pool_size = ULINT_MAX;
235/* force virtual page preallocation (prefault) */
236UNIV_INTERN my_bool srv_buf_pool_populate = FALSE;
235/* requested number of buffer pool instances */237/* requested number of buffer pool instances */
236UNIV_INTERN ulint srv_buf_pool_instances = 1;238UNIV_INTERN ulint srv_buf_pool_instances = 1;
237/* previously requested size */239/* previously requested size */
238240
=== modified file 'Percona-Server/storage/innobase/srv/srv0start.c'
--- Percona-Server/storage/innobase/srv/srv0start.c 2012-09-28 07:53:51 +0000
+++ Percona-Server/storage/innobase/srv/srv0start.c 2012-10-18 18:03:21 +0000
@@ -1540,7 +1540,8 @@
1540 ((double) srv_buf_pool_size) / (1024 * 1024));1540 ((double) srv_buf_pool_size) / (1024 * 1024));
1541 }1541 }
15421542
1543 err = buf_pool_init(srv_buf_pool_size, srv_buf_pool_instances);1543 err = buf_pool_init(srv_buf_pool_size, (ibool) srv_buf_pool_populate,
1544 srv_buf_pool_instances);
15441545
1545 ut_print_timestamp(stderr);1546 ut_print_timestamp(stderr);
1546 fprintf(stderr,1547 fprintf(stderr,

Subscribers

People subscribed via source and target branches