[PATCH 13/13] spufs: set irq affinity for running threads

Nathan Lynch ntl at pobox.com
Thu Jan 5 15:42:27 EST 2006


Arnd Bergmann wrote:
> For far, all SPU triggered interrupts always end up on
> the first SMT thread, which is a bad solution.
> 
> This patch implements setting the affinity to the
> CPU that was running last when entering execution on
> an SPU. This should result in a significant reduction
> in IPI calls and better cache locality for SPE thread
> specific data.

...

> --- linux-2.6.15-rc.orig/arch/powerpc/platforms/cell/spufs/sched.c
> +++ linux-2.6.15-rc/arch/powerpc/platforms/cell/spufs/sched.c
> @@ -357,6 +357,11 @@ int spu_activate(struct spu_context *ctx
>  	if (!spu)
>  		return (signal_pending(current)) ? -ERESTARTSYS : -EAGAIN;
>  	bind_context(spu, ctx);
> +	/*
> +	 * We're likely to wait for interrupts on the same
> +	 * CPU that we are now on, so send them here.
> +	 */
> +	spu_irq_setaffinity(spu, smp_processor_id());

With CONFIG_DEBUG_PREEMPT this will give a warning about using
smp_processor_id in pre-emptible context if I'm reading the code
correctly.

Maybe use raw_smp_processor_id, since setting the affinity to this cpu
isn't a hard requirement?




More information about the Linuxppc64-dev mailing list