Commit 4af25e1a authored by Simon Marlow's avatar Simon Marlow
Browse files

Pad Capabilities and Tasks to 64 bytes

This is just good practice to avoid placing two structures heavily
accessed by different CPUs on the same cache line
parent 05dce654
......@@ -106,8 +106,10 @@ struct Capability_ {
StgTRecChunk *free_trec_chunks;
StgTRecHeader *free_trec_headers;
nat transaction_tokens;
}; // typedef Capability, defined in RtsAPI.h
} // typedef Capability is defined in RtsAPI.h
// Capabilities are stored in an array, so make sure that adjacent
// Capabilities don't share any cache-lines:
ATTRIBUTE_ALIGNED(64);
#if defined(THREADED_RTS)
......
......@@ -114,7 +114,8 @@ newTask (void)
#endif
Task *task;
task = stgMallocBytes(sizeof(Task), "newTask");
#define ROUND_TO_CACHE_LINE(x) ((((x)+63) / 64) * 64)
task = stgMallocBytes(ROUND_TO_CACHE_LINE(sizeof(Task)), "newTask");
task->cap = NULL;
task->stopped = rtsFalse;
......
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