{"id":251,"url":"http://patchwork.ozlabs.org/api/1.1/patches/251/?format=json","web_url":"http://patchwork.ozlabs.org/project/cbe-oss-dev/patch/200809112037.49688.adetsch@br.ibm.com/","project":{"id":1,"url":"http://patchwork.ozlabs.org/api/1.1/projects/1/?format=json","name":"Cell Broadband Engine development","link_name":"cbe-oss-dev","list_id":"cbe-oss-dev.ozlabs.org","list_email":"cbe-oss-dev@ozlabs.org","web_url":null,"scm_url":null,"webscm_url":null},"msgid":"<200809112037.49688.adetsch@br.ibm.com>","date":"2008-09-11T23:37:49","name":"powerpc/spufs: Set gang scheduling parameters for the gang.","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"e40d0bfff5aef1768841e88f9a0b0f6c60dd77a3","submitter":{"id":93,"url":"http://patchwork.ozlabs.org/api/1.1/people/93/?format=json","name":"Andre Detsch","email":"adetsch@br.ibm.com"},"delegate":{"id":1,"url":"http://patchwork.ozlabs.org/api/1.1/users/1/?format=json","username":"jk","first_name":"Jeremy","last_name":"Kerr","email":"jk@ozlabs.org"},"mbox":"http://patchwork.ozlabs.org/project/cbe-oss-dev/patch/200809112037.49688.adetsch@br.ibm.com/mbox/","series":[],"comments":"http://patchwork.ozlabs.org/api/patches/251/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/251/checks/","tags":{},"headers":{"Return-Path":"<cbe-oss-dev-bounces+patchwork=ozlabs.org@ozlabs.org>","X-Original-To":["patchwork@ozlabs.org","cbe-oss-dev@ozlabs.org"],"Delivered-To":["patchwork@ozlabs.org","cbe-oss-dev@ozlabs.org"],"Received":["from ozlabs.org (localhost [127.0.0.1])\n\tby ozlabs.org (Postfix) with ESMTP id 709CDDE350\n\tfor <patchwork@ozlabs.org>; Fri, 12 Sep 2008 09:39:41 +1000 (EST)","from igw3.br.ibm.com (igw3.br.ibm.com [32.104.18.26])\n\t(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\n\t(Client CN \"igw3.br.ibm.com\", Issuer \"Equifax\" (verified OK))\n\tby ozlabs.org (Postfix) with ESMTPS id C5763DE011;\n\tFri, 12 Sep 2008 09:38:50 +1000 (EST)","from mailhub3.br.ibm.com (unknown [9.18.232.110])\n\tby igw3.br.ibm.com (Postfix) with ESMTP id 4F3D8390009;\n\tThu, 11 Sep 2008 20:17:25 -0300 (BRST)","from d24av02.br.ibm.com (d24av02.br.ibm.com [9.18.232.47])\n\tby mailhub3.br.ibm.com (8.13.8/8.13.8/NCO v8.7) with ESMTP id\n\tm8BNccKB2318464; Thu, 11 Sep 2008 20:38:43 -0300","from d24av02.br.ibm.com (loopback [127.0.0.1])\n\tby d24av02.br.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id\n\tm8BNcUJd029548; Thu, 11 Sep 2008 20:38:31 -0300","from [9.8.10.86] ([9.8.10.86])\n\tby d24av02.br.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id\n\tm8BNcUPk029529; Thu, 11 Sep 2008 20:38:30 -0300"],"From":"Andre Detsch <adetsch@br.ibm.com>","To":"cbe-oss-dev@ozlabs.org","Date":"Thu, 11 Sep 2008 20:37:49 -0300","User-Agent":"KMail/1.9.6","References":"<200809111955.28780.adetsch@br.ibm.com>","In-Reply-To":"<200809111955.28780.adetsch@br.ibm.com>","MIME-Version":"1.0","Content-Disposition":"inline","Message-Id":"<200809112037.49688.adetsch@br.ibm.com>","Cc":"LukeBrowning@us.ibm.com, Jeremy Kerr <jk@ozlabs.org>","Subject":"[Cbe-oss-dev] [PATCH 03/11] powerpc/spufs: Set gang scheduling\n\tparameters 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\n\t<cbe-oss-dev.ozlabs.org>","List-Unsubscribe":"<https://ozlabs.org/mailman/options/cbe-oss-dev>,\n\t<mailto:cbe-oss-dev-request@ozlabs.org?subject=unsubscribe>","List-Archive":"<http://ozlabs.org/pipermail/cbe-oss-dev>","List-Post":"<mailto:cbe-oss-dev@ozlabs.org>","List-Help":"<mailto:cbe-oss-dev-request@ozlabs.org?subject=help>","List-Subscribe":"<https://ozlabs.org/mailman/listinfo/cbe-oss-dev>,\n\t<mailto:cbe-oss-dev-request@ozlabs.org?subject=subscribe>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Sender":"cbe-oss-dev-bounces+patchwork=ozlabs.org@ozlabs.org","Errors-To":"cbe-oss-dev-bounces+patchwork=ozlabs.org@ozlabs.org"},"content":"Priority, policy, and NUMA cpu mask are inherited from the thread\nthat creates the first context.\n\nNote a follow on patch will implement effective priority and policy\nparameters that are derived from each thread.\n\nSigned-off-by: Luke Browning <lukebrowning@us.ibm.com>\nSigned-off-by: Andre Detsch <adetsch@br.ibm.com>","diff":"diff --git a/arch/powerpc/platforms/cell/spufs/gang.c \nb/arch/powerpc/platforms/cell/spufs/gang.c\nindex 71a4432..2a01271 100644\n--- a/arch/powerpc/platforms/cell/spufs/gang.c\n+++ b/arch/powerpc/platforms/cell/spufs/gang.c\n@@ -39,6 +39,16 @@ struct spu_gang *alloc_spu_gang(void)\n \tINIT_LIST_HEAD(&gang->list);\n \tINIT_LIST_HEAD(&gang->aff_list_head);\n \n+\t/*\n+\t * Inherit scheduling parameters from the creator of the gang.\n+\t */\n+\tif (rt_prio(current->prio))\n+\t\tgang->prio = current->prio;\n+\telse\n+\t\tgang->prio = current->static_prio;\n+\tgang->policy = current->policy;\n+\tgang->cpus_allowed = current->cpus_allowed;\n+\n out:\n \treturn gang;\n }\ndiff --git a/arch/powerpc/platforms/cell/spufs/sched.c \nb/arch/powerpc/platforms/cell/spufs/sched.c\nindex 386aa0a..0e29f12 100644\n--- a/arch/powerpc/platforms/cell/spufs/sched.c\n+++ b/arch/powerpc/platforms/cell/spufs/sched.c\n@@ -95,10 +95,12 @@ static struct timer_list spuloadavg_timer;\n  */\n void spu_set_timeslice(struct spu_context *ctx)\n {\n-\tif (ctx->prio < NORMAL_PRIO)\n-\t\tctx->time_slice = SCALE_PRIO(DEF_SPU_TIMESLICE * 4, ctx->prio);\n+\tstruct spu_gang *gang = ctx->gang;\n+\n+\tif (gang->prio < NORMAL_PRIO)\n+\t\tctx->time_slice = SCALE_PRIO(DEF_SPU_TIMESLICE * 4, gang->prio);\n \telse\n-\t\tctx->time_slice = SCALE_PRIO(DEF_SPU_TIMESLICE, ctx->prio);\n+\t\tctx->time_slice = SCALE_PRIO(DEF_SPU_TIMESLICE, gang->prio);\n }\n \n /*\n@@ -132,6 +134,13 @@ void __spu_update_sched_info(struct spu_context *ctx)\n \tctx->policy = current->policy;\n \n \t/*\n+\t * TO DO: effective gang priorities.  Currently, the gang's priority\n+\t * is inherited from the thread that allocates the gang structure.\n+\t * Therefore, it never changes.  It should be based on the dynamic\n+\t * value of the controlling threads.\n+\t */\n+\n+\t/*\n \t * TO DO: the context may be loaded, so we may need to activate\n \t * it again on a different node. But it shouldn't hurt anything\n \t * to update its parameters, because we know that the scheduler\n@@ -141,6 +150,12 @@ void __spu_update_sched_info(struct spu_context *ctx)\n \t */\n \tctx->cpus_allowed = current->cpus_allowed;\n \n+\t/*\n+\t * TO DO: NUMA gang scheduling. The placement of the gang onto spus\n+\t * is based on the value of the cpus_allowed field of the thread\n+\t * that created the gang. It should be dynamic too.  eww.\n+\t */\n+\n \t/* Save the current cpu id for spu interrupt routing. */\n \tctx->last_ran = raw_smp_processor_id();\n }\ndiff --git a/arch/powerpc/platforms/cell/spufs/spufs.h \nb/arch/powerpc/platforms/cell/spufs/spufs.h\nindex 8ae8ef9..03f0a3c 100644\n--- a/arch/powerpc/platforms/cell/spufs/spufs.h\n+++ b/arch/powerpc/platforms/cell/spufs/spufs.h\n@@ -162,6 +162,11 @@ struct spu_gang {\n \tstruct kref kref;\n \tint contexts;\n \n+\t/* scheduler fields */\n+\tcpumask_t cpus_allowed;\n+\tint policy;\n+\tint prio;\n+\n \tstruct spu_context *aff_ref_ctx;\n \tstruct list_head aff_list_head;\n \tstruct mutex aff_mutex;\n","prefixes":[]}