cmake: Add option for "mem: per-CPU allocator cache (ThunderX2 workaround)"
Change-Id: I7156cf433b2081246d1d9b8e4fde489609676ef1
This commit is contained in:
@@ -87,6 +87,7 @@ option(ENABLE_RUSAGE "Enable rusage support" ON)
|
|||||||
option(ENABLE_QLMPI "Enable qlmpi programs" OFF)
|
option(ENABLE_QLMPI "Enable qlmpi programs" OFF)
|
||||||
option(ENABLE_UTI "Enable uti support" OFF)
|
option(ENABLE_UTI "Enable uti support" OFF)
|
||||||
option(ENABLE_UBSAN "Enable undefined behaviour sanitizer on mckernel size" OFF)
|
option(ENABLE_UBSAN "Enable undefined behaviour sanitizer on mckernel size" OFF)
|
||||||
|
option(ENABLE_PER_CPU_ALLOC_CACHE "Enable per-CPU allocator cache (ThunderX2 workaround)" OFF)
|
||||||
|
|
||||||
find_package(PkgConfig REQUIRED)
|
find_package(PkgConfig REQUIRED)
|
||||||
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH ON)
|
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH ON)
|
||||||
@@ -197,4 +198,5 @@ message("ENABLE_UTI: ${ENABLE_UTI}")
|
|||||||
message("ENABLE_WERROR: ${ENABLE_WERROR}")
|
message("ENABLE_WERROR: ${ENABLE_WERROR}")
|
||||||
message("ENABLE_UBSAN: ${ENABLE_UBSAN}")
|
message("ENABLE_UBSAN: ${ENABLE_UBSAN}")
|
||||||
message("ENABLE_LINUX_WORK_IRQ_FOR_IKC: ${ENABLE_LINUX_WORK_IRQ_FOR_IKC}")
|
message("ENABLE_LINUX_WORK_IRQ_FOR_IKC: ${ENABLE_LINUX_WORK_IRQ_FOR_IKC}")
|
||||||
|
message("ENABLE_PER_CPU_ALLOC_CACHE: ${ENABLE_PER_CPU_ALLOC_CACHE}")
|
||||||
message("-------------------------------")
|
message("-------------------------------")
|
||||||
|
|||||||
@@ -28,6 +28,9 @@
|
|||||||
/* whether undefined behaviour sanitizer is enabled */
|
/* whether undefined behaviour sanitizer is enabled */
|
||||||
#cmakedefine ENABLE_UBSAN 1
|
#cmakedefine ENABLE_UBSAN 1
|
||||||
|
|
||||||
|
/* whether per-CPU allocator cache (ThunderX2 workaround) is enabled */
|
||||||
|
#cmakedefine ENABLE_PER_CPU_ALLOC_CACHE 1
|
||||||
|
|
||||||
/* Path of bind-mount source directory */
|
/* Path of bind-mount source directory */
|
||||||
#cmakedefine ROOTFSDIR "${ROOTFSDIR}"
|
#cmakedefine ROOTFSDIR "${ROOTFSDIR}"
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,9 @@ void cpu_local_var_init(void)
|
|||||||
clv[i].monitor = monitor->cpu + i;
|
clv[i].monitor = monitor->cpu + i;
|
||||||
clv[i].rusage = rusage.cpu + i;
|
clv[i].rusage = rusage.cpu + i;
|
||||||
INIT_LIST_HEAD(&clv[i].smp_func_req_list);
|
INIT_LIST_HEAD(&clv[i].smp_func_req_list);
|
||||||
|
#ifdef ENABLE_PER_CPU_ALLOC_CACHE
|
||||||
clv[i].free_chunks.rb_node = NULL;
|
clv[i].free_chunks.rb_node = NULL;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
cpu_local_var_initialized = 1;
|
cpu_local_var_initialized = 1;
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include <process.h>
|
#include <process.h>
|
||||||
#include <syscall.h>
|
#include <syscall.h>
|
||||||
|
#include <config.h>
|
||||||
/*
|
/*
|
||||||
* CPU Local Storage (cls)
|
* CPU Local Storage (cls)
|
||||||
*/
|
*/
|
||||||
@@ -103,8 +104,10 @@ struct cpu_local_var {
|
|||||||
|
|
||||||
/* UTI */
|
/* UTI */
|
||||||
void *uti_futex_resp;
|
void *uti_futex_resp;
|
||||||
|
#ifdef ENABLE_PER_CPU_ALLOC_CACHE
|
||||||
/* Per-CPU memory allocator cache */
|
/* Per-CPU memory allocator cache */
|
||||||
struct rb_root free_chunks;
|
struct rb_root free_chunks;
|
||||||
|
#endif
|
||||||
} __attribute__((aligned(64)));
|
} __attribute__((aligned(64)));
|
||||||
|
|
||||||
extern int cpu_local_var_initialized;
|
extern int cpu_local_var_initialized;
|
||||||
|
|||||||
@@ -609,6 +609,7 @@ unsigned long ihk_numa_alloc_pages(struct ihk_mc_numa_node *node,
|
|||||||
unsigned long addr = 0;
|
unsigned long addr = 0;
|
||||||
mcs_lock_node_t mcs_node;
|
mcs_lock_node_t mcs_node;
|
||||||
|
|
||||||
|
#ifdef ENABLE_PER_CPU_ALLOC_CACHE
|
||||||
/* Check CPU local cache first */
|
/* Check CPU local cache first */
|
||||||
if (cpu_local_var_initialized) {
|
if (cpu_local_var_initialized) {
|
||||||
unsigned long irqflags;
|
unsigned long irqflags;
|
||||||
@@ -624,6 +625,7 @@ unsigned long ihk_numa_alloc_pages(struct ihk_mc_numa_node *node,
|
|||||||
return addr;
|
return addr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
mcs_lock_lock(&node->lock, &mcs_node);
|
mcs_lock_lock(&node->lock, &mcs_node);
|
||||||
|
|
||||||
@@ -652,6 +654,7 @@ void ihk_numa_free_pages(struct ihk_mc_numa_node *node,
|
|||||||
{
|
{
|
||||||
mcs_lock_node_t mcs_node;
|
mcs_lock_node_t mcs_node;
|
||||||
|
|
||||||
|
#ifdef ENABLE_PER_CPU_ALLOC_CACHE
|
||||||
/* CPU local cache */
|
/* CPU local cache */
|
||||||
if (cpu_local_var_initialized) {
|
if (cpu_local_var_initialized) {
|
||||||
unsigned long irqflags;
|
unsigned long irqflags;
|
||||||
@@ -670,6 +673,7 @@ void ihk_numa_free_pages(struct ihk_mc_numa_node *node,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (addr < node->min_addr ||
|
if (addr < node->min_addr ||
|
||||||
(addr + (npages << PAGE_SHIFT)) > node->max_addr) {
|
(addr + (npages << PAGE_SHIFT)) > node->max_addr) {
|
||||||
|
|||||||
Reference in New Issue
Block a user