From: zhoucm1 <david1.zhou-5C7GfCeVMHo@public.gmane.org>
To: "Christian König" <christian.koenig-5C7GfCeVMHo@public.gmane.org>,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
andresx7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Subject: Re: [PATCH 2/2] drm/amd/sched: add schuduling policy
Date: Thu, 16 Mar 2017 17:15:37 +0800 [thread overview]
Message-ID: <58CA57B9.4000306@amd.com> (raw)
In-Reply-To: <ad692555-8641-2ec7-f90e-eee0e8b97c2c-5C7GfCeVMHo@public.gmane.org>
On 2017年03月16日 17:10, Christian König wrote:
> Am 16.03.2017 um 10:00 schrieb Chunming Zhou:
>> if high priority rq is full, then process with low priority could be
>> starve.
>> Add policy for this problem, the high proiority can ahead of next
>> priority queue,
>> the ratio is 2 : 1.
>>
>> Change-Id: I58f4a6b9cdce8689b18dd8e83dd6e2cf5f99d5fb
>> Signed-off-by: Chunming Zhou <David1.Zhou@amd.com>
>
> Well, the idea behind the high priority queues is to actually starve
> the low priority queues to a certain amount.
>
> At least for the kernel queue that is really desired.
Yes, agree, but we certainly don't want low priority queue is totally
dead, which doesn't have chance to run if high priority queue is always
full and busy.
If without Andres changes, it doesn't matter. But after Andres changes
upstream, we need scheduling policy.
Regards,
David Zhou
>
> Christian.
>
>> ---
>> drivers/gpu/drm/amd/scheduler/gpu_scheduler.c | 26
>> +++++++++++++++++++++++---
>> drivers/gpu/drm/amd/scheduler/gpu_scheduler.h | 2 ++
>> 2 files changed, 25 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
>> b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
>> index 0f439dd..4637b6f 100644
>> --- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
>> +++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
>> @@ -35,11 +35,16 @@
>> static void amd_sched_process_job(struct fence *f, struct fence_cb
>> *cb);
>> /* Initialize a given run queue struct */
>> -static void amd_sched_rq_init(struct amd_sched_rq *rq)
>> +static void amd_sched_rq_init(struct amd_gpu_scheduler *sched, enum
>> + amd_sched_priority pri)
>> {
>> + struct amd_sched_rq *rq = &sched->sched_rq[pri];
>> +
>> spin_lock_init(&rq->lock);
>> INIT_LIST_HEAD(&rq->entities);
>> rq->current_entity = NULL;
>> + rq->wait_base = pri * 2;
>> + rq->wait = rq->wait_base;
>> }
>> static void amd_sched_rq_add_entity(struct amd_sched_rq *rq,
>> @@ -494,17 +499,32 @@ static void amd_sched_wakeup(struct
>> amd_gpu_scheduler *sched)
>> {
>> struct amd_sched_entity *entity;
>> int i;
>> + bool skip;
>> if (!amd_sched_ready(sched))
>> return NULL;
>> +retry:
>> + skip = false;
>> /* Kernel run queue has higher priority than normal run queue*/
>> for (i = AMD_SCHED_PRIORITY_MAX - 1; i >=
>> AMD_SCHED_PRIORITY_MIN; i--) {
>> + if ((i > AMD_SCHED_PRIORITY_MIN) &&
>> + (sched->sched_rq[i - 1].wait >=
>> sched->sched_rq[i].wait_base)) {
>> + sched->sched_rq[i - 1].wait = sched->sched_rq[i -
>> 1].wait_base;
>> + skip = true;
>> + continue;
>> + }
>> entity = amd_sched_rq_select_entity(&sched->sched_rq[i]);
>> - if (entity)
>> + if (entity) {
>> + if (i > AMD_SCHED_PRIORITY_MIN)
>> + sched->sched_rq[i - 1].wait++;
>> break;
>> + }
>> }
>> + if (!entity && skip)
>> + goto retry;
>> +
>> return entity;
>> }
>> @@ -608,7 +628,7 @@ int amd_sched_init(struct amd_gpu_scheduler
>> *sched,
>> sched->name = name;
>> sched->timeout = timeout;
>> for (i = AMD_SCHED_PRIORITY_MIN; i < AMD_SCHED_PRIORITY_MAX; i++)
>> - amd_sched_rq_init(&sched->sched_rq[i]);
>> + amd_sched_rq_init(sched, i);
>> init_waitqueue_head(&sched->wake_up_worker);
>> init_waitqueue_head(&sched->job_scheduled);
>> diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h
>> b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h
>> index 99f0240..4caed30 100644
>> --- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h
>> +++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h
>> @@ -64,6 +64,8 @@ struct amd_sched_rq {
>> spinlock_t lock;
>> struct list_head entities;
>> struct amd_sched_entity *current_entity;
>> + int wait_base;
>> + int wait;
>> };
>> struct amd_sched_fence {
>
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2017-03-16 9:15 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-16 9:00 [PATCH 0/2] *** add scheduling policy *** Chunming Zhou
[not found] ` <1489654849-6031-1-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org>
2017-03-16 9:00 ` [PATCH 1/2] drm/amd/sched: revise priority number Chunming Zhou
[not found] ` <1489654849-6031-2-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org>
2017-03-16 9:08 ` Christian König
2017-03-16 9:00 ` [PATCH 2/2] drm/amd/sched: add schuduling policy Chunming Zhou
[not found] ` <1489654849-6031-3-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org>
2017-03-16 9:10 ` Christian König
[not found] ` <ad692555-8641-2ec7-f90e-eee0e8b97c2c-5C7GfCeVMHo@public.gmane.org>
2017-03-16 9:15 ` zhoucm1 [this message]
[not found] ` <58CA57B9.4000306-5C7GfCeVMHo@public.gmane.org>
2017-03-16 15:13 ` Andres Rodriguez
[not found] ` <4c0f45fa-3f76-d33d-6cd0-83ba1d39a3f3-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-03-16 15:31 ` Andres Rodriguez
[not found] ` <f99a087f-d479-dcd1-8d00-bdd46df10eae-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-03-16 16:01 ` Christian König
[not found] ` <0da11bd5-d21e-d059-2987-28d650d10463-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-03-16 16:31 ` Andres Rodriguez
[not found] ` <55502bc2-c5d5-1636-5bd5-6c385746343a-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-03-17 2:35 ` Zhou, David(ChunMing)
[not found] ` <MWHPR1201MB0206DC9ED4550D01BE31DBAAB4390-3iK1xFAIwjrUF/YbdlDdgWrFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2017-03-17 3:30 ` Michel Dänzer
2017-03-17 7:54 ` Christian König
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=58CA57B9.4000306@amd.com \
--to=david1.zhou-5c7gfcevmho@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=andresx7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=christian.koenig-5C7GfCeVMHo@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.