From patchwork Fri Aug 3 07:06:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nayan Deshmukh X-Patchwork-Id: 10554615 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4E17B15A6 for ; Fri, 3 Aug 2018 07:07:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 396D02C038 for ; Fri, 3 Aug 2018 07:07:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2CF592C2E1; Fri, 3 Aug 2018 07:07:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C48DF2C038 for ; Fri, 3 Aug 2018 07:07:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 188DB6E0D1; Fri, 3 Aug 2018 07:06:59 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pl0-x243.google.com (mail-pl0-x243.google.com [IPv6:2607:f8b0:400e:c01::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 96EC36E0AE; Fri, 3 Aug 2018 07:06:57 +0000 (UTC) Received: by mail-pl0-x243.google.com with SMTP id e11-v6so2173840plb.3; Fri, 03 Aug 2018 00:06:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ozK55h6SUSf2j3jBCgLYY1Ag5GtbbFa0ySsIMzkR5I0=; b=HNC2/Ymd6NGXK90R3x0Ypi3dj6UEJmrdWhAURTRxEiA/1Bs6gBdJR5KtQkJQG2DSt2 VuJCqp4uMoU38KzOB2T4DeiDngyBicXQdHh75zMV5N0qfJD5WBP8D9LyBT12rxcNPaB1 Karo3X8cXER3t1Hmlu8KY4qUMl+0cxSj2t0tSZ1UP8sTD0W7/NbkhRxfD5IrzQh1sind g+pYw4hmp3NH8TJggBfnDp/8cLBaIAQT/gbVz9PrJ2JXTxItNKebmFrCL5pVEIyNI2vG MDWLCxkcq1VFmTnJcpMTrzhc8czw5aVUPelJqsu8I7kbW+UtZ25CMen+5O6wp4DyW3JP rzJw== X-Gm-Message-State: AOUpUlFZ/OmyH8D+Yw+hwEvwhi9z0rSaemIctW1/mWnTkXHOUooaAvpq B5loqD55vkFlvhUkhWPsvuEqCZaR X-Google-Smtp-Source: AAOMgpdSsQpx+Qm0P56VMF3pulSbMtYoW38TJBe3iguRW9hlXNRN5iUS0GsShzs3/Ah5RAJSLjW3FA== X-Received: by 2002:a17:902:722:: with SMTP id 31-v6mr2403397pli.207.1533280017011; Fri, 03 Aug 2018 00:06:57 -0700 (PDT) Received: from localhost.localdomain ([47.247.82.190]) by smtp.gmail.com with ESMTPSA id b76-v6sm6795653pfj.184.2018.08.03.00.06.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Aug 2018 00:06:55 -0700 (PDT) From: Nayan Deshmukh To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/scheduler: select the least loaded sched during entity init Date: Fri, 3 Aug 2018 12:36:28 +0530 Message-Id: <20180803070628.21471-1-nayan26deshmukh@gmail.com> X-Mailer: git-send-email 2.14.3 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nayan Deshmukh , christian.koenig@amd.com, amd-gfx@lists.freedesktop.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Instead of assigning entity to the first scheduler in the list assign it to the least loaded scheduler. Signed-off-by: Nayan Deshmukh --- drivers/gpu/drm/scheduler/gpu_scheduler.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/scheduler/gpu_scheduler.c b/drivers/gpu/drm/scheduler/gpu_scheduler.c index 21fa0d8a8783..dbd707d24597 100644 --- a/drivers/gpu/drm/scheduler/gpu_scheduler.c +++ b/drivers/gpu/drm/scheduler/gpu_scheduler.c @@ -61,6 +61,8 @@ static bool drm_sched_entity_is_ready(struct drm_sched_entity *entity); static void drm_sched_wakeup(struct drm_gpu_scheduler *sched); static void drm_sched_process_job(struct dma_fence *f, struct dma_fence_cb *cb); +static struct drm_sched_rq * +drm_sched_entity_get_free_sched(struct drm_sched_entity *entity); /** * drm_sched_rq_init - initialize a given run queue struct @@ -186,13 +188,13 @@ int drm_sched_entity_init(struct drm_sched_entity *entity, memset(entity, 0, sizeof(struct drm_sched_entity)); INIT_LIST_HEAD(&entity->list); - entity->rq = rq_list[0]; entity->guilty = guilty; entity->num_rq_list = num_rq_list; entity->rq_list = kcalloc(num_rq_list, sizeof(struct drm_sched_rq *), GFP_KERNEL); for (i = 0; i < num_rq_list; ++i) entity->rq_list[i] = rq_list[i]; + entity->rq = drm_sched_entity_get_free_sched(entity); entity->last_scheduled = NULL; spin_lock_init(&entity->rq_lock);