Skip to content

Pin thread_filler to its NUMA node #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: numa
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pmbw.cc
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,8 @@ void* thread_master(void* cookie)
int node_num = thread_num % g_numa_nodes;
int node_offset = thread_num / g_numa_nodes;
int threads_per_node_ceil = (g_nthreads + g_numa_nodes - 1) / g_numa_nodes;
// pin to numa node
numa_run_on_node(node_num);

const std::vector<int>& cpuset = g_numa_cpuset[node_num];
pin_self_to_core(cpuset[node_offset % cpuset.size()]);
Expand Down Expand Up @@ -709,6 +711,8 @@ void* thread_worker(void* cookie)
// set NUMA node for task and preferred allocation
int node_num = thread_num % g_numa_nodes;
int node_offset = thread_num / g_numa_nodes;
// pin to numa node
numa_run_on_node(node_num);

const std::vector<int>& cpuset = g_numa_cpuset[node_num];
pin_self_to_core(cpuset[node_offset % cpuset.size()]);
Expand Down Expand Up @@ -803,6 +807,8 @@ void* thread_filler(void* cookie)
int node_num = *((int*)cookie);
delete (int*)cookie;

numa_run_on_node(node_num);

double ts1 = timestamp();
memset(g_memarea[node_num], 1, g_memsize_node);
double ts2 = timestamp();
Expand Down