[Cbe-oss-dev] [PATCH 17/28]MARS/base: cache workload context

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


Yuji Mano wrote:
> --- a/base/src/mpu/kernel/kernel.c
> +++ b/base/src/mpu/kernel/kernel.c
(snip)
> @@ -773,6 +776,18 @@ static int search_block(int block, int r
>  		MARS_BITS_SET(&queue_block.bits[index], WORKLOAD_COUNTER,
>  			      MARS_WORKLOAD_COUNTER_MIN);
>  
> +		/* check if this kernel ran this workload most recently */
> +		workload_cached =
> +			(workload_id ==
> +				MARS_WORKLOAD_PER_BLOCK * block + index) &&
> +			(kernel_params.kernel_id ==
> +				MARS_BITS_GET(&queue_block.bits[index],
> +					      WORKLOAD_KERNEL_ID));
> +
> +		/* set the kernel id of this kernel into block bits */
> +		MARS_BITS_SET(&queue_block.bits[index], WORKLOAD_KERNEL_ID,
> +			      kernel_params.kernel_id);
> +
>  		/* update queue header bits and reset block counter */
>  		update_header_bits(block);
>  		update_header_bits_counter(block, 1);

I suppose the 'WORKLOAD_KERNEL_ID' should be reset when a workload is
scheduled (i.e. when the workload transits to SCHEDULING state) since
workload IDs can be reused and cached context is no longer valid.

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



More information about the cbe-oss-dev mailing list