Message ID | 20180803070628.21471-1-nayan26deshmukh@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/scheduler: select the least loaded sched during entity init | expand |
Am 03.08.2018 um 09:06 schrieb Nayan Deshmukh: > Instead of assigning entity to the first scheduler in the list > assign it to the least loaded scheduler. I thought about that as well, but then abandoned the idea. The reason is that we are going to reassign the rq when the first job is pushed to it anyway. This will only become useful when we take the number of entities a rq has into account for the decision as well. Christian. > > Signed-off-by: Nayan Deshmukh <nayan26deshmukh@gmail.com> > --- > 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);
Ah...you are correct. We will reschedule on the first job push. I didn't take that into account. Let's drop this patch then. Thanks, Nayan On Fri, Aug 3, 2018, 4:12 PM Christian König < ckoenig.leichtzumerken@gmail.com> wrote: > Am 03.08.2018 um 09:06 schrieb Nayan Deshmukh: > > Instead of assigning entity to the first scheduler in the list > > assign it to the least loaded scheduler. > > I thought about that as well, but then abandoned the idea. > > The reason is that we are going to reassign the rq when the first job is > pushed to it anyway. > > This will only become useful when we take the number of entities a rq > has into account for the decision as well. > > Christian. > > > > > Signed-off-by: Nayan Deshmukh <nayan26deshmukh@gmail.com> > > --- > > 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); > > <div dir="auto">Ah...you are correct. We will reschedule on the first job push. I didn't take that into account. Let's drop this patch then.<div dir="auto"><br></div><div dir="auto">Thanks,</div><div dir="auto">Nayan</div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Aug 3, 2018, 4:12 PM Christian König <<a href="mailto:ckoenig.leichtzumerken@gmail.com">ckoenig.leichtzumerken@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Am 03.08.2018 um 09:06 schrieb Nayan Deshmukh:<br> > Instead of assigning entity to the first scheduler in the list<br> > assign it to the least loaded scheduler.<br> <br> I thought about that as well, but then abandoned the idea.<br> <br> The reason is that we are going to reassign the rq when the first job is <br> pushed to it anyway.<br> <br> This will only become useful when we take the number of entities a rq <br> has into account for the decision as well.<br> <br> Christian.<br> <br> ><br> > Signed-off-by: Nayan Deshmukh <<a href="mailto:nayan26deshmukh@gmail.com" target="_blank" rel="noreferrer">nayan26deshmukh@gmail.com</a>><br> > ---<br> > drivers/gpu/drm/scheduler/gpu_scheduler.c | 4 +++-<br> > 1 file changed, 3 insertions(+), 1 deletion(-)<br> ><br> > diff --git a/drivers/gpu/drm/scheduler/gpu_scheduler.c b/drivers/gpu/drm/scheduler/gpu_scheduler.c<br> > index 21fa0d8a8783..dbd707d24597 100644<br> > --- a/drivers/gpu/drm/scheduler/gpu_scheduler.c<br> > +++ b/drivers/gpu/drm/scheduler/gpu_scheduler.c<br> > @@ -61,6 +61,8 @@<br> > static bool drm_sched_entity_is_ready(struct drm_sched_entity *entity);<br> > static void drm_sched_wakeup(struct drm_gpu_scheduler *sched);<br> > static void drm_sched_process_job(struct dma_fence *f, struct dma_fence_cb *cb);<br> > +static struct drm_sched_rq *<br> > +drm_sched_entity_get_free_sched(struct drm_sched_entity *entity);<br> > <br> > /**<br> > * drm_sched_rq_init - initialize a given run queue struct<br> > @@ -186,13 +188,13 @@ int drm_sched_entity_init(struct drm_sched_entity *entity,<br> > <br> > memset(entity, 0, sizeof(struct drm_sched_entity));<br> > INIT_LIST_HEAD(&entity->list);<br> > - entity->rq = rq_list[0];<br> > entity->guilty = guilty;<br> > entity->num_rq_list = num_rq_list;<br> > entity->rq_list = kcalloc(num_rq_list, sizeof(struct drm_sched_rq *),<br> > GFP_KERNEL);<br> > for (i = 0; i < num_rq_list; ++i)<br> > entity->rq_list[i] = rq_list[i];<br> > + entity->rq = drm_sched_entity_get_free_sched(entity);<br> > entity->last_scheduled = NULL;<br> > <br> > spin_lock_init(&entity->rq_lock);<br> <br> </blockquote></div>
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);
Instead of assigning entity to the first scheduler in the list assign it to the least loaded scheduler. Signed-off-by: Nayan Deshmukh <nayan26deshmukh@gmail.com> --- drivers/gpu/drm/scheduler/gpu_scheduler.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)