Skip to content
Permalink
Browse files

Remove redundant UT_LIST_INIT() calls

The macro UT_LIST_INIT() zero-initializes the UT_LIST_NODE.
There is no need to call this macro on a buffer that has
already been zero-initialized by mem_zalloc() or mem_heap_zalloc()
or similar.

For some reason, the statement UT_LIST_INIT(srv_sys->tasks) in
srv_init() caused a SIGSEGV on server startup when compiling with
GCC 7.1.0 for AMD64 using -O3. The zero-initialization was attempted
by the instruction movaps %xmm0,0x50(%rax), while the proper offset
of srv_sys->tasks would seem to have been 0x48.
  • Loading branch information...
dr-m committed May 17, 2017
1 parent 4754f88 commit 956d2540c456059db85af860ce5cf47e5a5dd796
@@ -2,6 +2,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Copyright (c) 2017, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -1343,8 +1344,6 @@ buf_pool_init_instance(
buf_pool->chunks = chunk =
(buf_chunk_t*) mem_zalloc(sizeof *chunk);

UT_LIST_INIT(buf_pool->free);

if (!buf_chunk_init(buf_pool, chunk, buf_pool_size)) {
mem_free(chunk);
mem_free(buf_pool);
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2014, 2017, MariaDB Corporation. All Rights Reserved.
Copyright (c) 2014, 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -1546,8 +1546,6 @@ fil_init(
fil_system->spaces = hash_create(hash_size);
fil_system->name_hash = hash_create(hash_size);

UT_LIST_INIT(fil_system->LRU);

fil_system->max_n_open = max_n_open;
}

@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2010, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -225,9 +226,6 @@ row_fts_psort_info_init(
each parallel sort thread. Each "sort bucket" holds records for
a particular "FTS index partition" */
for (j = 0; j < fts_sort_pll_degree; j++) {

UT_LIST_INIT(psort_info[j].fts_doc_list);

for (i = 0; i < FTS_NUM_AUX_INDEX; i++) {

psort_info[j].merge_file[i] =
@@ -1011,8 +1011,6 @@ srv_init(void)
srv_monitor_event = os_event_create();

srv_buf_dump_event = os_event_create();

UT_LIST_INIT(srv_sys->tasks);
}

/* page_zip_stat_per_index_mutex is acquired from:
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2011, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -48,8 +49,6 @@ sess_open(void)
sess->trx = trx_allocate_for_background();
sess->trx->sess = sess;

UT_LIST_INIT(sess->graphs);

return(sess);
}

@@ -2,6 +2,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Copyright (c) 2017, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -1432,8 +1433,6 @@ buf_pool_init_instance(
buf_pool->chunks = chunk =
(buf_chunk_t*) mem_zalloc(sizeof *chunk);

UT_LIST_INIT(buf_pool->free);

if (!buf_chunk_init(buf_pool, chunk, buf_pool_size)) {
mem_free(chunk);
mem_free(buf_pool);
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2014, 2017, MariaDB Corporation. All Rights Reserved.
Copyright (c) 2014, 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -1598,8 +1598,6 @@ fil_init(
fil_system->spaces = hash_create(hash_size);
fil_system->name_hash = hash_create(hash_size);

UT_LIST_INIT(fil_system->LRU);

fil_system->max_n_open = max_n_open;
}

@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2010, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -228,9 +229,6 @@ row_fts_psort_info_init(
each parallel sort thread. Each "sort bucket" holds records for
a particular "FTS index partition" */
for (j = 0; j < fts_sort_pll_degree; j++) {

UT_LIST_INIT(psort_info[j].fts_doc_list);

for (i = 0; i < FTS_NUM_AUX_INDEX; i++) {

psort_info[j].merge_file[i] =
@@ -1164,8 +1164,6 @@ srv_init(void)
if (srv_track_changed_pages) {
os_event_set(srv_redo_log_tracked_event);
}

UT_LIST_INIT(srv_sys->tasks);
}

/* page_zip_stat_per_index_mutex is acquired from:
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2011, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -48,8 +49,6 @@ sess_open(void)
sess->trx = trx_allocate_for_background();
sess->trx->sess = sess;

UT_LIST_INIT(sess->graphs);

return(sess);
}

0 comments on commit 956d254

Please sign in to comment.
You can’t perform that action at this time.