[Cbe-oss-dev] [PATCH 8/10] MARS: workload queue mutex protection

Yuji Mano Yuji.Mano at am.sony.com
Fri Aug 29 08:53:02 EST 2008


Kazunori Asayama wrote:
> Yuji Mano wrote:
>> This adds mutex protection when accessing the shared workload queue.
>> 
>> Prior to this patch the kernel scheduler accessed the whole queue block
>> atomically. Now the kernel scheduler atomically locks the queue block when it
>> needs to access it.
>> 
>> Host-side access of the queue block now also uses the mutex locks to keep the
>> workload queue functions thread-safe.
>> 
>> This also replaces the previously used MARS context mutex. The workload queue
>> handles its own mutex without the workload model APIs needing to manage the
>> MARS context mutex.
>> 
>> Signed-off-by: Yuji Mano <yuji.mano at am.sony.com>
> 
> (snip)
> 
>> --- a/include/common/mars/mars_workload_types.h
>> +++ b/include/common/mars/mars_workload_types.h
>> @@ -64,9 +64,9 @@ extern "C" {
>>  #define MARS_WORKLOAD_SIGNAL_ON			0x1	/* signal set on */
>>  #define MARS_WORKLOAD_SIGNAL_OFF		0x0	/* signal set off */
>>  
>> -#define MARS_WORKLOAD_MAX			1024	/* wl max */
>> -#define MARS_WORKLOAD_PER_BLOCK			16	/* wl per block */
>> -#define MARS_WORKLOAD_NUM_BLOCKS		64	/* wl max / per block */
>> +#define MARS_WORKLOAD_PER_BLOCK			15	/* wl/block */
> 
> This change of MARS_WORKLOAD_PER_BLOCK from 16 to 15 will cause *real*
> divide operation on MPU when calculating block number and index in the
> block by ID, i.e.:
> 
>   	int block = id / MARS_WORKLOAD_PER_BLOCK;
>   	int index = id % MARS_WORKLOAD_PER_BLOCK;
> 
> I think we should avoid that, if possible.
> 
> Other things look ok to me.

Unfortunately I can't think of a possible solution with the current
implementation to keep it 16.
Of course we can reduce MARS_WORKLOAD_PER_BLOCK, but that might be more wasteful
than beneficial.

If you do not have any other suggestions can you please ack this patch?
We can explore optimizations and improvements in the future.

Regards,
Yuji




More information about the cbe-oss-dev mailing list