Commit 5724ea01 authored by Edward Z. Yang's avatar Edward Z. Yang

More accurate cost attribution for stacks. Fixes #7818.

Previously, stacks were always attributed to CCCS_SYSTEM.  Now, we
attribute them to the CCS when the stack was allocated.  If a stack
grows, new stack chunks inherit the CCS of the old stack.
Signed-off-by: Edward Z. Yang's avatarEdward Z. Yang <ezyang@mit.edu>
parent 2a7f4de3
......@@ -84,7 +84,7 @@ createThread(Capability *cap, W_ size)
stack_size = round_to_mblocks(size - sizeofW(StgTSO));
stack = (StgStack *)allocate(cap, stack_size);
TICK_ALLOC_STACK(stack_size);
SET_HDR(stack, &stg_STACK_info, CCS_SYSTEM);
SET_HDR(stack, &stg_STACK_info, cap->r.rCCCS);
stack->stack_size = stack_size - sizeofW(StgStack);
stack->sp = stack->stack + stack->stack_size;
stack->dirty = 1;
......@@ -575,7 +575,7 @@ threadStackOverflow (Capability *cap, StgTSO *tso)
chunk_size * sizeof(W_));
new_stack = (StgStack*) allocate(cap, chunk_size);
SET_HDR(new_stack, &stg_STACK_info, CCS_SYSTEM);
SET_HDR(new_stack, &stg_STACK_info, old_stack->header.prof.ccs);
TICK_ALLOC_STACK(chunk_size);
new_stack->dirty = 0; // begin clean, we'll mark it dirty below
......
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