Commit 24c83d48 authored by John Esmet's avatar John Esmet Committed by Yoni Fogel

use the XMALLOC_N_ALIGNED API in portability


git-svn-id: file:///svn/toku/tokudb@52286 c7de825b-a66e-492c-adef-691d508d4ae1
parent 28ac13d3
...@@ -43,24 +43,6 @@ ...@@ -43,24 +43,6 @@
#include <util/rwlock.h> #include <util/rwlock.h>
#include <util/kibbutz.h> #include <util/kibbutz.h>
// TODO: Move me to portability/memory.cc and toku_include/memory.h
#if defined(HAVE_MALLOC_H)
# include <malloc.h>
#elif defined(HAVE_SYS_MALLOC_H)
# include <sys/malloc.h>
#endif
#if !defined(HAVE_MEMALIGN)
# if defined(HAVE_VALLOC)
static void *
memalign(size_t UU(alignment), size_t size)
{
return valloc(size);
}
# else
# error "no suitable aligned malloc available (checked memalign and valloc)"
# endif
#endif
static const size_t min_val_size = sizeof(int32_t); static const size_t min_val_size = sizeof(int32_t);
static const size_t min_key_size = sizeof(int32_t); static const size_t min_key_size = sizeof(int32_t);
...@@ -1534,8 +1516,8 @@ static int run_workers( ...@@ -1534,8 +1516,8 @@ static int run_workers(
if (cli_args->print_performance) { if (cli_args->print_performance) {
perf_formatter->header(cli_args, num_threads); perf_formatter->header(cli_args, num_threads);
} }
struct worker_extra *worker_extra = (struct worker_extra *) // allocate worker_extra's on cache line boundaries
memalign(64, num_threads * sizeof (struct worker_extra)); // allocate worker_extra's on cache line boundaries struct worker_extra *XMALLOC_N_ALIGNED(64, num_threads, worker_extra);
struct test_time_extra tte; struct test_time_extra tte;
tte.num_seconds = num_seconds; tte.num_seconds = num_seconds;
tte.crash_at_end = crash_at_end; tte.crash_at_end = crash_at_end;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment