Browse Source

branches/zip: Make innodb_use_sys_malloc=ON the default.

Replace srv_use_sys_malloc with UNIV_LIKELY(srv_use_sys_malloc)
to improve branch prediction in the default case.

Approved by Ken over the IM.
pull/374/head
marko 17 years ago
parent
commit
29b522b278
  1. 5
      ChangeLog
  2. 2
      handler/ha_innodb.cc
  3. 2
      mem/mem0dbg.c
  4. 4
      mem/mem0pool.c
  5. 2
      srv/srv0srv.c
  6. 2
      srv/srv0start.c
  7. 6
      ut/ut0mem.c

5
ChangeLog

@ -1,3 +1,8 @@
2009-02-20 The InnoDB Team
* handler/ha_innodb.cc:
Make innodb_use_sys_malloc=ON the default.
2009-02-20 The InnoDB Team 2009-02-20 The InnoDB Team
* handler/ha_innodb.cc, mysql-test/innodb-autoinc.result, * handler/ha_innodb.cc, mysql-test/innodb-autoinc.result,

2
handler/ha_innodb.cc

@ -9699,7 +9699,7 @@ static MYSQL_SYSVAR_STR(version, innodb_version_str,
static MYSQL_SYSVAR_BOOL(use_sys_malloc, srv_use_sys_malloc, static MYSQL_SYSVAR_BOOL(use_sys_malloc, srv_use_sys_malloc,
PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY, PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
"Use OS memory allocator instead of InnoDB's internal memory allocator", "Use OS memory allocator instead of InnoDB's internal memory allocator",
NULL, NULL, FALSE);
NULL, NULL, TRUE);
static MYSQL_SYSVAR_STR(change_buffering, innobase_change_buffering, static MYSQL_SYSVAR_STR(change_buffering, innobase_change_buffering,
PLUGIN_VAR_RQCMDARG, PLUGIN_VAR_RQCMDARG,

2
mem/mem0dbg.c

@ -154,7 +154,7 @@ mem_init(
mem_hash_initialized = TRUE; mem_hash_initialized = TRUE;
#endif #endif
if (srv_use_sys_malloc) {
if (UNIV_LIKELY(srv_use_sys_malloc)) {
/* When innodb_use_sys_malloc is set, the /* When innodb_use_sys_malloc is set, the
mem_comm_pool won't be used for any allocations. We mem_comm_pool won't be used for any allocations. We
create a dummy mem_comm_pool, because some statistics create a dummy mem_comm_pool, because some statistics

4
mem/mem0pool.c

@ -353,7 +353,7 @@ mem_area_alloc(
/* If we are using os allocator just make a simple call /* If we are using os allocator just make a simple call
to malloc */ to malloc */
if (srv_use_sys_malloc) {
if (UNIV_LIKELY(srv_use_sys_malloc)) {
return(malloc(*psize)); return(malloc(*psize));
} }
@ -491,7 +491,7 @@ mem_area_free(
ulint size; ulint size;
ulint n; ulint n;
if (srv_use_sys_malloc) {
if (UNIV_LIKELY(srv_use_sys_malloc)) {
free(ptr); free(ptr);
return; return;

2
srv/srv0srv.c

@ -161,7 +161,7 @@ collation */
UNIV_INTERN const byte* srv_latin1_ordering; UNIV_INTERN const byte* srv_latin1_ordering;
/* use os/external memory allocator */ /* use os/external memory allocator */
UNIV_INTERN my_bool srv_use_sys_malloc = FALSE;
UNIV_INTERN my_bool srv_use_sys_malloc = TRUE;
/* requested size in kilobytes */ /* requested size in kilobytes */
UNIV_INTERN ulint srv_buf_pool_size = ULINT_MAX; UNIV_INTERN ulint srv_buf_pool_size = ULINT_MAX;
/* previously requested size */ /* previously requested size */

2
srv/srv0start.c

@ -1069,7 +1069,7 @@ innobase_start_or_create_for_mysql(void)
"InnoDB: !!!!!!!! UNIV_MEM_DEBUG switched on !!!!!!!!!\n"); "InnoDB: !!!!!!!! UNIV_MEM_DEBUG switched on !!!!!!!!!\n");
#endif #endif
if (srv_use_sys_malloc) {
if (UNIV_LIKELY(srv_use_sys_malloc)) {
fprintf(stderr, fprintf(stderr,
"InnoDB: The InnoDB memory heap is disabled\n"); "InnoDB: The InnoDB memory heap is disabled\n");
} }

6
ut/ut0mem.c

@ -92,7 +92,7 @@ ut_malloc_low(
ulint retry_count; ulint retry_count;
void* ret; void* ret;
if (srv_use_sys_malloc) {
if (UNIV_LIKELY(srv_use_sys_malloc)) {
ret = malloc(n); ret = malloc(n);
ut_a(ret || !assert_on_error); ut_a(ret || !assert_on_error);
@ -275,7 +275,7 @@ ut_free(
{ {
ut_mem_block_t* block; ut_mem_block_t* block;
if (srv_use_sys_malloc) {
if (UNIV_LIKELY(srv_use_sys_malloc)) {
free(ptr); free(ptr);
return; return;
} }
@ -332,7 +332,7 @@ ut_realloc(
ulint min_size; ulint min_size;
void* new_ptr; void* new_ptr;
if (srv_use_sys_malloc) {
if (UNIV_LIKELY(srv_use_sys_malloc)) {
return(realloc(ptr, size)); return(realloc(ptr, size));
} }

Loading…
Cancel
Save