mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* 2.6.0 schedule_tick question
@ 2004-01-10 12:35 Der Herr Hofrat
  2004-01-11 16:57 ` Davide Libenzi
  0 siblings, 1 reply; 4+ messages in thread
From: Der Herr Hofrat @ 2004-01-10 12:35 UTC (permalink / raw)
  To: linux-kernel


HI !

 in 2.6.0 kernel/sched.c scheduler_tick currently the 
 case of rt_tasks for SCHED_RR is doing

	if ((p->policy == SCHED_RR) && !--p->time_slice) {
			...
                        dequeue_task(p, rq->active);
                        enqueue_task(p, rq->active);

 which is:

static inline void dequeue_task(struct task_struct *p, prio_array_t *array)
{
        array->nr_active--;
        list_del(&p->run_list);
        if (list_empty(array->queue + p->prio))
                __clear_bit(p->prio, array->bitmap);
}

static inline void enqueue_task(struct task_struct *p, prio_array_t *array)
{
        list_add_tail(&p->run_list, array->queue + p->prio);
        __set_bit(p->prio, array->bitmap);
        array->nr_active++;
        p->array = array;
}

 looking at these two functions this looks like quite some overhead as it
 actually could be reduced to:

        list_del(&p->run_list);
	list_add_tail(&p->run_list, array->queue + p->prio);

 for the rest I don't see any effect it would have ?

hofrat

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 2.6.0 schedule_tick question
  2004-01-11 16:57 ` Davide Libenzi
@ 2004-01-10 17:22   ` Der Herr Hofrat
  2004-01-11 17:32     ` Davide Libenzi
  0 siblings, 1 reply; 4+ messages in thread
From: Der Herr Hofrat @ 2004-01-10 17:22 UTC (permalink / raw)
  To: Davide Libenzi; +Cc: Der Herr Hofrat, linux-kernel

> 
> >  in 2.6.0 kernel/sched.c scheduler_tick currently the 
> >  case of rt_tasks for SCHED_RR is doing
> > 
> > 	if ((p->policy == SCHED_RR) && !--p->time_slice) {
> > 			...
> >                         dequeue_task(p, rq->active);
> >                         enqueue_task(p, rq->active);
> > 
> >  which is:
> > 
> > static inline void dequeue_task(struct task_struct *p, prio_array_t *array)
> > {
> >         array->nr_active--;
> >         list_del(&p->run_list);
> >         if (list_empty(array->queue + p->prio))
> >                 __clear_bit(p->prio, array->bitmap);
> > }
> > 
> > static inline void enqueue_task(struct task_struct *p, prio_array_t *array)
> > {
> >         list_add_tail(&p->run_list, array->queue + p->prio);
> >         __set_bit(p->prio, array->bitmap);
> >         array->nr_active++;
> >         p->array = array;
> > }
> > 
> >  looking at these two functions this looks like quite some overhead as it
> >  actually could be reduced to:
> > 
> >         list_del(&p->run_list);
> > 	list_add_tail(&p->run_list, array->queue + p->prio);
> > 
> >  for the rest I don't see any effect it would have ?
> 
> Yes, we could have a rotate_task() function but the impact is basically 
> zero because of the little overhead compared to the frequency of the 
> operation.
>
ok - well maby someone wants to drop it in any way as its
trivial and actually it would be easier to read if the function name
were rotate_task and not dequeue/enqueu to implement RR behavior.

thx !
hofrat
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 2.6.0 schedule_tick question
  2004-01-10 12:35 2.6.0 schedule_tick question Der Herr Hofrat
@ 2004-01-11 16:57 ` Davide Libenzi
  2004-01-10 17:22   ` Der Herr Hofrat
  0 siblings, 1 reply; 4+ messages in thread
From: Davide Libenzi @ 2004-01-11 16:57 UTC (permalink / raw)
  To: Der Herr Hofrat; +Cc: linux-kernel

On Sat, 10 Jan 2004, Der Herr Hofrat wrote:

>  in 2.6.0 kernel/sched.c scheduler_tick currently the 
>  case of rt_tasks for SCHED_RR is doing
> 
> 	if ((p->policy == SCHED_RR) && !--p->time_slice) {
> 			...
>                         dequeue_task(p, rq->active);
>                         enqueue_task(p, rq->active);
> 
>  which is:
> 
> static inline void dequeue_task(struct task_struct *p, prio_array_t *array)
> {
>         array->nr_active--;
>         list_del(&p->run_list);
>         if (list_empty(array->queue + p->prio))
>                 __clear_bit(p->prio, array->bitmap);
> }
> 
> static inline void enqueue_task(struct task_struct *p, prio_array_t *array)
> {
>         list_add_tail(&p->run_list, array->queue + p->prio);
>         __set_bit(p->prio, array->bitmap);
>         array->nr_active++;
>         p->array = array;
> }
> 
>  looking at these two functions this looks like quite some overhead as it
>  actually could be reduced to:
> 
>         list_del(&p->run_list);
> 	list_add_tail(&p->run_list, array->queue + p->prio);
> 
>  for the rest I don't see any effect it would have ?

Yes, we could have a rotate_task() function but the impact is basically 
zero because of the little overhead compared to the frequency of the 
operation.



- Davide



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 2.6.0 schedule_tick question
  2004-01-10 17:22   ` Der Herr Hofrat
@ 2004-01-11 17:32     ` Davide Libenzi
  0 siblings, 0 replies; 4+ messages in thread
From: Davide Libenzi @ 2004-01-11 17:32 UTC (permalink / raw)
  To: Der Herr Hofrat; +Cc: Linux Kernel Mailing List

On Sat, 10 Jan 2004, Der Herr Hofrat wrote:

> > Yes, we could have a rotate_task() function but the impact is basically 
> > zero because of the little overhead compared to the frequency of the 
> > operation.
> >
> ok - well maby someone wants to drop it in any way as its
> trivial and actually it would be easier to read if the function name
> were rotate_task and not dequeue/enqueu to implement RR behavior.

Try to push a patch to Ingo. We already had a move_last_runqueue() in 2.4, 
but since now we have names like xxxx_task(), I believe rotate_task() 
sounds better.



- Davide



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-01-11 17:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-10 12:35 2.6.0 schedule_tick question Der Herr Hofrat
2004-01-11 16:57 ` Davide Libenzi
2004-01-10 17:22   ` Der Herr Hofrat
2004-01-11 17:32     ` Davide Libenzi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®