[Cbe-oss-dev] [patch 05/18] cell: add placement computation for scheduling of affinity contexts

Jeremy Kerr jk at ozlabs.org
Mon Apr 30 19:16:15 EST 2007


Andre,

> This patch provides the spu affinity placement logic for the spufs
> scheduler. Each time a gang is going to be scheduled, the placement
> of a reference context is defined. The placement of all other
> contexts with affinity from the gang is defined based on this
> reference context location and on a precomputed displacement offset.

This looks fine to me, save a couple of very minor nitpicks. However, 
I'm going to leave the acking job to Christoph, as this is really his 
area of expertise...

> +static inline int sched_spu(struct spu *spu)
> +{
> +	return (!spu->ctx || !(spu->ctx->flags & SPU_CREATE_NOSCHED));
> +}

Can we give this a more descriptive name?

> +static void aff_set_ref_point_location(struct spu_gang *gang)
> +{
> +	int mem_aff, gs, lowest_offset;
> +	struct spu_context *ctx;
> +	struct spu *tmp;
> +
> +	mem_aff = gang->aff_ref_ctx->flags & SPU_CREATE_AFFINITY_MEM;
> +	lowest_offset = 0;
> +	gs = 0;
> +	list_for_each_entry(tmp, &gang->aff_list_head, aff_list)
> +		gs++;

No need to use list_for_each_entry here - list_for_each will do fine, 
then we can drop the 'tmp' variable.


> @@ -103,6 +104,8 @@ struct spu_gang {
>  	struct list_head aff_list_head;
>  	struct mutex aff_mutex;
>  	int aff_flags;
> +	struct spu *aff_ref_spu;
> +	atomic_t aff_sched_count;
>  };

It's not strictly necessary, but it might be a good idea to 
ATOMIC_INIT() the aff_sched_count explicitly on gang creation.

Cheers,


Jeremy



More information about the cbe-oss-dev mailing list