mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-11212 - Clean-up MariaDB atomic operations
Removed my_atomic_initialize(): it doesn't make sense anymore.
This commit is contained in:
@ -350,10 +350,6 @@ make_atomic_store(ptr)
|
|||||||
#define LF_BACKOFF (1)
|
#define LF_BACKOFF (1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MY_ATOMIC_OK 0
|
|
||||||
#define MY_ATOMIC_NOT_1CPU 1
|
|
||||||
extern int my_atomic_initialize();
|
|
||||||
|
|
||||||
#ifdef __ATOMIC_SEQ_CST
|
#ifdef __ATOMIC_SEQ_CST
|
||||||
#define MY_MEMORY_ORDER_RELAXED __ATOMIC_RELAXED
|
#define MY_MEMORY_ORDER_RELAXED __ATOMIC_RELAXED
|
||||||
#define MY_MEMORY_ORDER_CONSUME __ATOMIC_CONSUME
|
#define MY_MEMORY_ORDER_CONSUME __ATOMIC_CONSUME
|
||||||
|
@ -39,7 +39,7 @@ SET(MYSYS_SOURCES array.c charset-def.c charset.c checksum.c my_default.c
|
|||||||
my_getpagesize.c
|
my_getpagesize.c
|
||||||
lf_alloc-pin.c lf_dynarray.c lf_hash.c
|
lf_alloc-pin.c lf_dynarray.c lf_hash.c
|
||||||
safemalloc.c my_new.cc
|
safemalloc.c my_new.cc
|
||||||
my_atomic.c my_getncpus.c my_safehash.c my_chmod.c my_rnd.c
|
my_getncpus.c my_safehash.c my_chmod.c my_rnd.c
|
||||||
my_uuid.c wqueue.c waiting_threads.c ma_dyncol.c ../sql-common/my_time.c
|
my_uuid.c wqueue.c waiting_threads.c ma_dyncol.c ../sql-common/my_time.c
|
||||||
my_rdtsc.c my_context.c psi_noop.c
|
my_rdtsc.c my_context.c psi_noop.c
|
||||||
file_logger.c)
|
file_logger.c)
|
||||||
|
@ -1,67 +0,0 @@
|
|||||||
/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
|
|
||||||
|
|
||||||
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 Foundation; version 2 of the License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
|
|
||||||
|
|
||||||
#include <my_global.h>
|
|
||||||
#include <my_sys.h>
|
|
||||||
|
|
||||||
#include <my_atomic.h>
|
|
||||||
|
|
||||||
/*
|
|
||||||
checks that the current build of atomic ops
|
|
||||||
can run on this machine
|
|
||||||
|
|
||||||
RETURN
|
|
||||||
ATOMIC_xxx values, see my_atomic.h
|
|
||||||
*/
|
|
||||||
int my_atomic_initialize()
|
|
||||||
{
|
|
||||||
compile_time_assert(sizeof(intptr) == sizeof(void *));
|
|
||||||
/* currently the only thing worth checking is SMP/UP issue */
|
|
||||||
#ifdef MY_ATOMIC_MODE_DUMMY
|
|
||||||
return my_getncpus() == 1 ? MY_ATOMIC_OK : MY_ATOMIC_NOT_1CPU;
|
|
||||||
#else
|
|
||||||
return MY_ATOMIC_OK;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef SAFE_MUTEX
|
|
||||||
#undef pthread_mutex_init
|
|
||||||
#undef pthread_mutex_destroy
|
|
||||||
#undef pthread_mutex_lock
|
|
||||||
#undef pthread_mutex_unlock
|
|
||||||
|
|
||||||
void plain_pthread_mutex_init(safe_mutex_t *m)
|
|
||||||
{
|
|
||||||
pthread_mutex_init(& m->mutex, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
void plain_pthread_mutex_destroy(safe_mutex_t *m)
|
|
||||||
{
|
|
||||||
pthread_mutex_destroy(& m->mutex);
|
|
||||||
}
|
|
||||||
|
|
||||||
void plain_pthread_mutex_lock(safe_mutex_t *m)
|
|
||||||
{
|
|
||||||
pthread_mutex_lock(& m->mutex);
|
|
||||||
}
|
|
||||||
|
|
||||||
void plain_pthread_mutex_unlock(safe_mutex_t *m)
|
|
||||||
{
|
|
||||||
pthread_mutex_unlock(& m->mutex);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
@ -374,9 +374,7 @@ int fill_misc_data(THD *thd, TABLE_LIST *tables)
|
|||||||
{
|
{
|
||||||
TABLE *table= tables->table;
|
TABLE *table= tables->table;
|
||||||
|
|
||||||
#ifdef MY_ATOMIC_OK
|
|
||||||
INSERT1("Cpu_count", (my_getncpus(), UNSIGNED));
|
INSERT1("Cpu_count", (my_getncpus(), UNSIGNED));
|
||||||
#endif
|
|
||||||
INSERT1("Mem_total", (my_getphysmem(), UNSIGNED));
|
INSERT1("Mem_total", (my_getphysmem(), UNSIGNED));
|
||||||
INSERT1("Now", (thd->query_start(), UNSIGNED));
|
INSERT1("Now", (thd->query_start(), UNSIGNED));
|
||||||
|
|
||||||
|
@ -251,10 +251,6 @@ int main()
|
|||||||
|
|
||||||
plan(35);
|
plan(35);
|
||||||
|
|
||||||
if (my_atomic_initialize())
|
|
||||||
return exit_status();
|
|
||||||
|
|
||||||
|
|
||||||
lockman_init(&lockman, &loid2lo, 50);
|
lockman_init(&lockman, &loid2lo, 50);
|
||||||
|
|
||||||
for (i= 0; i < Nlos; i++)
|
for (i= 0; i < Nlos; i++)
|
||||||
|
@ -263,10 +263,6 @@ int main()
|
|||||||
|
|
||||||
plan(35);
|
plan(35);
|
||||||
|
|
||||||
if (my_atomic_initialize())
|
|
||||||
return exit_status();
|
|
||||||
|
|
||||||
|
|
||||||
lockman_init(&lockman, &loid2lo, 50);
|
lockman_init(&lockman, &loid2lo, 50);
|
||||||
tablockman_init(&tablockman, &loid2lo1, 50);
|
tablockman_init(&tablockman, &loid2lo1, 50);
|
||||||
|
|
||||||
|
@ -295,10 +295,6 @@ int main(int argc __attribute__((unused)), char **argv)
|
|||||||
|
|
||||||
plan(40);
|
plan(40);
|
||||||
|
|
||||||
if (my_atomic_initialize())
|
|
||||||
return exit_status();
|
|
||||||
|
|
||||||
|
|
||||||
tablockman_init(&tablockman, &loid2lo1, 50);
|
tablockman_init(&tablockman, &loid2lo1, 50);
|
||||||
|
|
||||||
for (i= 0; i < Nlos; i++)
|
for (i= 0; i < Nlos; i++)
|
||||||
|
@ -141,9 +141,6 @@ int main(int argc __attribute__((unused)), char **argv)
|
|||||||
|
|
||||||
plan(7);
|
plan(7);
|
||||||
|
|
||||||
if (my_atomic_initialize())
|
|
||||||
return exit_status();
|
|
||||||
|
|
||||||
pthread_mutex_init(&rt_mutex, 0);
|
pthread_mutex_init(&rt_mutex, 0);
|
||||||
pthread_attr_init(&attr);
|
pthread_attr_init(&attr);
|
||||||
#ifdef HAVE_PTHREAD_ATTR_GETSTACKSIZE
|
#ifdef HAVE_PTHREAD_ATTR_GETSTACKSIZE
|
||||||
|
@ -182,15 +182,12 @@ pthread_handler_t test_lf_hash(void *arg)
|
|||||||
|
|
||||||
void do_tests()
|
void do_tests()
|
||||||
{
|
{
|
||||||
plan(7);
|
plan(6);
|
||||||
|
|
||||||
lf_alloc_init(&lf_allocator, sizeof(TLA), offsetof(TLA, not_used));
|
lf_alloc_init(&lf_allocator, sizeof(TLA), offsetof(TLA, not_used));
|
||||||
lf_hash_init(&lf_hash, sizeof(int), LF_HASH_UNIQUE, 0, sizeof(int), 0,
|
lf_hash_init(&lf_hash, sizeof(int), LF_HASH_UNIQUE, 0, sizeof(int), 0,
|
||||||
&my_charset_bin);
|
&my_charset_bin);
|
||||||
|
|
||||||
bad= my_atomic_initialize();
|
|
||||||
ok(!bad, "my_atomic_initialize() returned %d", bad);
|
|
||||||
|
|
||||||
with_my_thread_init= 1;
|
with_my_thread_init= 1;
|
||||||
test_concurrently("lf_pinbox (with my_thread_init)", test_lf_pinbox, N= THREADS, CYCLES);
|
test_concurrently("lf_pinbox (with my_thread_init)", test_lf_pinbox, N= THREADS, CYCLES);
|
||||||
test_concurrently("lf_alloc (with my_thread_init)", test_lf_alloc, N= THREADS, CYCLES);
|
test_concurrently("lf_alloc (with my_thread_init)", test_lf_alloc, N= THREADS, CYCLES);
|
||||||
|
@ -118,11 +118,7 @@ pthread_handler_t test_atomic_cas(void *arg)
|
|||||||
|
|
||||||
void do_tests()
|
void do_tests()
|
||||||
{
|
{
|
||||||
plan(6);
|
plan(5);
|
||||||
|
|
||||||
bad= my_atomic_initialize();
|
|
||||||
ok(!bad, "my_atomic_initialize() returned %d", bad);
|
|
||||||
|
|
||||||
|
|
||||||
b32= c32= 0;
|
b32= c32= 0;
|
||||||
test_concurrently("my_atomic_add32", test_atomic_add, THREADS, CYCLES);
|
test_concurrently("my_atomic_add32", test_atomic_add, THREADS, CYCLES);
|
||||||
|
@ -186,14 +186,11 @@ void do_tests()
|
|||||||
skip(1, "Big test skipped");
|
skip(1, "Big test skipped");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
plan(14);
|
plan(13);
|
||||||
compile_time_assert(THREADS >= 4);
|
compile_time_assert(THREADS >= 4);
|
||||||
|
|
||||||
DBUG_PRINT("wt", ("================= initialization ==================="));
|
DBUG_PRINT("wt", ("================= initialization ==================="));
|
||||||
|
|
||||||
bad= my_atomic_initialize();
|
|
||||||
ok(!bad, "my_atomic_initialize() returned %d", bad);
|
|
||||||
|
|
||||||
pthread_cond_init(&thread_sync, 0);
|
pthread_cond_init(&thread_sync, 0);
|
||||||
pthread_mutex_init(&lock, 0);
|
pthread_mutex_init(&lock, 0);
|
||||||
wt_init();
|
wt_init();
|
||||||
|
Reference in New Issue
Block a user