From f9ec6ecf38c17755809dc9e2165a75787794648b Mon Sep 17 00:00:00 2001 From: FritzFlorian Date: Fri, 29 May 2020 17:01:18 +0200 Subject: [PATCH] Touch all stack memory in scheduler. --- lib/pls/CMakeLists.txt | 2 ++ lib/pls/src/internal/scheduling/lock_free/task_manager.cpp | 3 +++ 2 files changed, 5 insertions(+) diff --git a/lib/pls/CMakeLists.txt b/lib/pls/CMakeLists.txt index cb7c6f4..263b62d 100644 --- a/lib/pls/CMakeLists.txt +++ b/lib/pls/CMakeLists.txt @@ -68,12 +68,14 @@ if (PLS_PROFILER) else () set(PLS_PROFILING_ENABLED false) endif () +message("-- PLS Profiler: ${PLS_PROFILER}") option(SLEEP_WORKERS "Enable sleeping workers if queues are empty" OFF) if (SLEEP_WORKERS) set(PLS_SLEEP_WORKERS_ON_EMPTY true) else () set(PLS_SLEEP_WORKERS_ON_EMPTY false) endif () +message("-- Sleep Workers: ${SLEEP_WORKERS}") configure_file(include/pls/internal/build_flavour.h.in include/pls/internal/build_flavour.h) diff --git a/lib/pls/src/internal/scheduling/lock_free/task_manager.cpp b/lib/pls/src/internal/scheduling/lock_free/task_manager.cpp index 67e1b66..d37aaff 100644 --- a/lib/pls/src/internal/scheduling/lock_free/task_manager.cpp +++ b/lib/pls/src/internal/scheduling/lock_free/task_manager.cpp @@ -16,6 +16,9 @@ task_manager::task_manager(unsigned thread_id, for (size_t i = 0; i < num_tasks; i++) { char *stack_memory = stack_allocator->allocate_stack(stack_size); + for (size_t j = 0; j < stack_size; j += base::system_details::CACHE_LINE_SIZE) { + stack_memory[j] = 'a'; // Touch all stacks, forces the OS to actually allocate them + } tasks_.emplace_back(std::make_unique(stack_memory, stack_size, i, thread_id)); if (i > 0) { -- libgit2 0.26.0