summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@mariadb.org>2016-05-03 12:21:17 +0400
committerSergey Vojtovich <svoj@mariadb.org>2016-05-03 12:21:17 +0400
commit87a341bf5fbc752705ba88bd3ce5110777ac241e (patch)
treef0403ed52ea52c162690720fa3f303d6da330225
parent8ffd10b85143efb0db8dc2ac0db952855addd4a5 (diff)
downloadmariadb-git-bb-10.2-mdev9857.tar.gz
MDEV-9857 - CACHE_LINE_SIZE in innodb should be 128 on POWERbb-10.2-mdev9857
Replaced hard-coded cache line size. Changes based on Daniel Black's work.
-rw-r--r--include/lf.h13
-rw-r--r--mysys/lf_alloc-pin.c2
-rw-r--r--storage/perfschema/pfs_global.h2
3 files changed, 10 insertions, 7 deletions
diff --git a/include/lf.h b/include/lf.h
index 19bdafce647..d2cfd7ed0ad 100644
--- a/include/lf.h
+++ b/include/lf.h
@@ -68,11 +68,14 @@ typedef struct {
void *purgatory;
uint32 purgatory_count;
uint32 volatile link;
-/* we want sizeof(LF_PINS) to be 128 to avoid false sharing */
- char pad[128-sizeof(uint32)*2
- -sizeof(LF_PINBOX *)
- -sizeof(void*)
- -sizeof(void *)*(LF_PINBOX_PINS+1)];
+ /*
+ we want sizeof(LF_PINS) to be CPU_LEVEL1_DCACHE_LINESIZE * 2
+ to avoid false sharing
+ */
+ char pad[CPU_LEVEL1_DCACHE_LINESIZE * 2 - sizeof(uint32) * 2
+ - sizeof(LF_PINBOX*)
+ - sizeof(void*)
+ - sizeof(void*) * (LF_PINBOX_PINS + 1)];
} LF_PINS;
/* compile-time assert to make sure we have enough pins. */
diff --git a/mysys/lf_alloc-pin.c b/mysys/lf_alloc-pin.c
index b349ef88ed1..325b59e806b 100644
--- a/mysys/lf_alloc-pin.c
+++ b/mysys/lf_alloc-pin.c
@@ -121,7 +121,7 @@ void lf_pinbox_init(LF_PINBOX *pinbox, uint free_ptr_offset,
lf_pinbox_free_func *free_func, void *free_func_arg)
{
DBUG_ASSERT(free_ptr_offset % sizeof(void *) == 0);
- compile_time_assert(sizeof(LF_PINS) == 128);
+ compile_time_assert(sizeof(LF_PINS) == CPU_LEVEL1_DCACHE_LINESIZE * 2);
lf_dynarray_init(&pinbox->pinarray, sizeof(LF_PINS));
pinbox->pinstack_top_ver= 0;
pinbox->pins_in_array= 0;
diff --git a/storage/perfschema/pfs_global.h b/storage/perfschema/pfs_global.h
index f3326c5589f..7373f459599 100644
--- a/storage/perfschema/pfs_global.h
+++ b/storage/perfschema/pfs_global.h
@@ -31,7 +31,7 @@ extern bool pfs_initialized;
extern size_t pfs_allocated_memory;
#if defined(HAVE_POSIX_MEMALIGN) || defined(HAVE_MEMALIGN) || defined(HAVE_ALIGNED_MALLOC)
-#define PFS_ALIGNEMENT 64
+#define PFS_ALIGNEMENT CPU_LEVEL1_DCACHE_LINESIZE
#define PFS_ALIGNED MY_ALIGNED(PFS_ALIGNEMENT)
#else
/*