From patchwork Thu Oct 18 15:37:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nayan Deshmukh X-Patchwork-Id: 10647549 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 58EF115E2 for ; Thu, 18 Oct 2018 15:38:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4AFB428D3A for ; Thu, 18 Oct 2018 15:38:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3F0E328D4D; Thu, 18 Oct 2018 15:38:44 +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 D96FC28D3A for ; Thu, 18 Oct 2018 15:38:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 005D36E00D; Thu, 18 Oct 2018 15:38:41 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5C51A6E00D for ; Thu, 18 Oct 2018 15:38:39 +0000 (UTC) Received: by mail-pl1-x643.google.com with SMTP id e67-v6so5511661plb.6 for ; Thu, 18 Oct 2018 08:38:39 -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=NwBHPI+uQSYx/3Uc0axwr8cv9ImwWNOBRQaO6GZOJ0A=; b=j/94qdXxKdFDHMayG1NHYn/Us+pKrFTtdYQaeFdtKSearnMh4WA32ij27qEjK5Y9EE DajwWVQMxfrCLYQ5SU/xyrpkJ3VMTYe70yHrGI7YVzmxTC7qNrDYjpVIUtpNX9Vr3iE5 pedkEULj3Lr6A5kFE9ndrrOLe6UtZPMKNxVFAsytQbVqFKCdjFGKRch2vIOkF/NxkrqB 9VI/fCuIw/0EZ0mMqoKC9kdB3FcMuFVNQvK0c5r5KJoxETRRpQiVkklq7lrTSrdhk3Ly FnDXpo4QqVPXvNJHitJT0yb/usVmqKZsOQEfnD3exsxMIo4Qbw+IcGgmNW22Y9/wHel4 uOEQ== X-Gm-Message-State: ABuFfogEdLG8YVsEq0ZvtZ8O+nKWJybzz+qkGpjmbReEk5nzp0PQySqn E3YbhXUbpiJlsesKBqNpJy2mlJss X-Google-Smtp-Source: ACcGV62SETk2nESfEOh+s1zTmnMYytpxmzfX6gmNQfQYElE0o3q3xY5sKXUmpGmd/tTpqZCukIsyog== X-Received: by 2002:a17:902:7b84:: with SMTP id w4-v6mr29504682pll.32.1539877118443; Thu, 18 Oct 2018 08:38:38 -0700 (PDT) Received: from localhost.localdomain ([175.118.54.8]) by smtp.gmail.com with ESMTPSA id x15-v6sm33510529pfd.27.2018.10.18.08.38.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Oct 2018 08:38:37 -0700 (PDT) From: Nayan Deshmukh To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/scheduler: use hw_rq_count for load calculation Date: Fri, 19 Oct 2018 00:37:46 +0900 Message-Id: <20181018153746.25733-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 MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP If the hardware queue for a scheduler is empty then we don't need to the shift the entities from their current scheduler as they are not getting scheduled because of some dependency. Signed-off-by: Nayan Deshmukh --- drivers/gpu/drm/scheduler/sched_entity.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/gpu/drm/scheduler/sched_entity.c b/drivers/gpu/drm/scheduler/sched_entity.c index 3e22a54a99c2..4d18497d6ecf 100644 --- a/drivers/gpu/drm/scheduler/sched_entity.c +++ b/drivers/gpu/drm/scheduler/sched_entity.c @@ -130,6 +130,12 @@ drm_sched_entity_get_free_sched(struct drm_sched_entity *entity) int i; for (i = 0; i < entity->num_rq_list; ++i) { + if (atomic_read(&entity->rq_list[i]->sched->hw_rq_count) < + entity->rq_list[i]->sched->hw_submission_limit) { + rq = entity->rq_list[i]; + break; + } + num_jobs = atomic_read(&entity->rq_list[i]->sched->num_jobs); if (num_jobs < min_jobs) { min_jobs = num_jobs; @@ -470,6 +476,14 @@ void drm_sched_entity_select_rq(struct drm_sched_entity *entity) if (spsc_queue_count(&entity->job_queue) || entity->num_rq_list <= 1) return; + /* + * We don't need to shift entity if the hardware + * queue of current scheduler is empty + */ + if (atomic_read(&entity->rq->sched->hw_rq_count) < + entity->rq->sched->hw_submission_limit) + return; + fence = READ_ONCE(entity->last_scheduled); if (fence && !dma_fence_is_signaled(fence)) return;