From patchwork Wed Dec 10 19:40:39 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Detsch X-Patchwork-Id: 13307 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id CB3C2DDFC1 for ; Thu, 11 Dec 2008 06:41:44 +1100 (EST) X-Original-To: cbe-oss-dev@ozlabs.org Delivered-To: cbe-oss-dev@ozlabs.org Received: from igw3.br.ibm.com (igw3.br.ibm.com [32.104.18.26]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "igw3.br.ibm.com", Issuer "Equifax" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id BB755DDF07 for ; Thu, 11 Dec 2008 06:40:44 +1100 (EST) Received: from d24relay01.br.ibm.com (unknown [9.8.31.16]) by igw3.br.ibm.com (Postfix) with ESMTP id EBAAF390262 for ; Wed, 10 Dec 2008 17:37:10 -0200 (BRDT) Received: from d24av01.br.ibm.com (d24av01.br.ibm.com [9.18.232.46]) by d24relay01.br.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id mBAKeEQK3768574 for ; Wed, 10 Dec 2008 17:40:14 -0300 Received: from d24av01.br.ibm.com (loopback [127.0.0.1]) by d24av01.br.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id mBAJedlK016994 for ; Wed, 10 Dec 2008 17:40:39 -0200 Received: from [9.8.13.23] ([9.8.13.23]) by d24av01.br.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id mBAJedNm016960 for ; Wed, 10 Dec 2008 17:40:39 -0200 From: Andre Detsch To: cbe-oss-dev@ozlabs.org Date: Wed, 10 Dec 2008 17:40:39 -0200 User-Agent: KMail/1.9.6 References: <200812101719.42964.adetsch@br.ibm.com> In-Reply-To: <200812101719.42964.adetsch@br.ibm.com> MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200812101740.39345.adetsch@br.ibm.com> Subject: [Cbe-oss-dev] [PATCH 03/18] powerpc/spufs: Set gang scheduling parameters for the gang. X-BeenThere: cbe-oss-dev@ozlabs.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Discussion about Open Source Software for the Cell Broadband Engine List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: cbe-oss-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Errors-To: cbe-oss-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Priority, policy, and NUMA cpu mask are inherited from the thread that creates the first context. Note a follow on patch will implement effective priority and policy parameters that are derived from each thread. Signed-off-by: Luke Browning Signed-off-by: Andre Detsch --- arch/powerpc/platforms/cell/spufs/gang.c | 10 ++++++++++ arch/powerpc/platforms/cell/spufs/sched.c | 21 ++++++++++++++++++--- arch/powerpc/platforms/cell/spufs/spufs.h | 5 +++++ 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/platforms/cell/spufs/gang.c b/arch/powerpc/platforms/cell/spufs/gang.c index 71a4432..2a01271 100644 --- a/arch/powerpc/platforms/cell/spufs/gang.c +++ b/arch/powerpc/platforms/cell/spufs/gang.c @@ -39,6 +39,16 @@ struct spu_gang *alloc_spu_gang(void) INIT_LIST_HEAD(&gang->list); INIT_LIST_HEAD(&gang->aff_list_head); + /* + * Inherit scheduling parameters from the creator of the gang. + */ + if (rt_prio(current->prio)) + gang->prio = current->prio; + else + gang->prio = current->static_prio; + gang->policy = current->policy; + gang->cpus_allowed = current->cpus_allowed; + out: return gang; } diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c index 8ebbf05..1fc0c3d 100644 --- a/arch/powerpc/platforms/cell/spufs/sched.c +++ b/arch/powerpc/platforms/cell/spufs/sched.c @@ -95,10 +95,12 @@ static struct timer_list spuloadavg_timer; */ void spu_set_timeslice(struct spu_context *ctx) { - if (ctx->prio < NORMAL_PRIO) - ctx->time_slice = SCALE_PRIO(DEF_SPU_TIMESLICE * 4, ctx->prio); + struct spu_gang *gang = ctx->gang; + + if (gang->prio < NORMAL_PRIO) + ctx->time_slice = SCALE_PRIO(DEF_SPU_TIMESLICE * 4, gang->prio); else - ctx->time_slice = SCALE_PRIO(DEF_SPU_TIMESLICE, ctx->prio); + ctx->time_slice = SCALE_PRIO(DEF_SPU_TIMESLICE, gang->prio); } /* @@ -132,6 +134,13 @@ static void __spu_update_sched_info(struct spu_context *ctx) ctx->policy = current->policy; /* + * TO DO: effective gang priorities. Currently, the gang's priority + * is inherited from the thread that allocates the gang structure. + * Therefore, it never changes. It should be based on the dynamic + * value of the controlling threads. + */ + + /* * TO DO: the context may be loaded, so we may need to activate * it again on a different node. But it shouldn't hurt anything * to update its parameters, because we know that the scheduler @@ -141,6 +150,12 @@ static void __spu_update_sched_info(struct spu_context *ctx) */ ctx->cpus_allowed = current->cpus_allowed; + /* + * TO DO: NUMA gang scheduling. The placement of the gang onto spus + * is based on the value of the cpus_allowed field of the thread + * that created the gang. It should be dynamic too. eww. + */ + /* Save the current cpu id for spu interrupt routing. */ ctx->last_ran = raw_smp_processor_id(); } diff --git a/arch/powerpc/platforms/cell/spufs/spufs.h b/arch/powerpc/platforms/cell/spufs/spufs.h index cb42aee..a8f5203 100644 --- a/arch/powerpc/platforms/cell/spufs/spufs.h +++ b/arch/powerpc/platforms/cell/spufs/spufs.h @@ -161,6 +161,11 @@ struct spu_gang { struct kref kref; int contexts; + /* scheduler fields */ + cpumask_t cpus_allowed; + int policy; + int prio; + struct spu_context *aff_ref_ctx; struct list_head aff_list_head; struct mutex aff_mutex;