[Cbe-oss-dev] [PATCH 09/28]MARS/base: workload queue cleanup

Kazunori Asayama asayama at sm.sony.co.jp
Fri Feb 6 15:57:32 EST 2009


Yuji Mano wrote:
> --- a/base/src/host/lib/workload_queue.c
> +++ b/base/src/host/lib/workload_queue.c
(snip)
> +static void init_blocks(uint64_t queue_ea)
> +{
> +	int block;
>  	int index;
> -	struct mars_workload_queue_block *block =
> -		mars_ea_work_area_get(block_ea,
> -				      MARS_WORKLOAD_QUEUE_BLOCK_ALIGN,
> -				      sizeof(struct mars_workload_queue_block));
> +	uint64_t bits = 0;
> +	struct mars_workload_queue_block *queue_block;
> +
> +	/* create initial bit pattern of workload queue blocks */
> +	MARS_BITS_SET(&bits, STATE, MARS_WORKLOAD_STATE_NONE);
>  
> -	for (index = 0; index < MARS_WORKLOAD_PER_BLOCK; index++)
> -		block->bits[index] = initial_bits;
> +	/* other bits are set by mars_workload_queue_schedule_begin properly */
>  
> -	mars_ea_put(block_ea, block, sizeof(struct mars_workload_queue_block));
> -	mars_mutex_reset(block_ea);
> +	/* initialize workload queue blocks */
> +	for (block = 0; block < MARS_WORKLOAD_NUM_BLOCKS; block++) {
> +		uint64_t block_ea = get_block_ea(queue_ea, block);
> +		queue_block = mars_ea_work_area_get(
> +				block_ea, MARS_WORKLOAD_QUEUE_BLOCK_ALIGN,
> +				sizeof(struct mars_workload_queue_block));
> +
> +		for (index = 0; index < MARS_WORKLOAD_PER_BLOCK; index++)
> +			queue_block->bits[index] = bits;
> +
> +		mars_ea_put(block_ea, queue_block,
> +			    sizeof(struct mars_workload_queue_block));
> +		mars_mutex_reset(block_ea);
> +	}
>  }

Please move the content of the loop to another separate function like
the original code, because mars_ea_work_area_get allocates work area on
the stack for each call on discrete memory model platforms.

-- 
(Kazunori Asayama
  (asayama at sm.sony.co.jp))
t



More information about the cbe-oss-dev mailing list