Re: [PATCH 1/4] Replace hooks with pre/post schedule and wakeup methods

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Steven Rostedt <rostedt@...>
Cc: linux-kernel <linux-kernel@...>, Ingo Molnar <mingo@...>, <vatsa@...>, Balbir Singh <balbir@...>, Peter Zijlstra <a.p.zijlstra@...>, Gregory Haskins <ghaskins@...>, Steven Rostedt <srostedt@...>
Date: Tuesday, December 11, 2007 - 6:56 am

On 11/12/2007, Steven Rostedt <rostedt@goodmis.org> wrote:

IMHO, it looks much better this way.

I had an idea of having a set of defined 'load balancing' points in
sched.c. Then every sched_class would provide smth like struct
load_balance_ops; that contains a number of callbacks (one per load
balancing point) or just one generic load_balance() method with an
additional argument to distinguish between different 'points'. Then we
could have smth like :

generic_load_balance(event, rq, task)
{
      for_each_sched_class (class) {
              if (!class->load_balance)
                       continue;
              if (class->load_balance(event, rq, task))
                       break; /* success, don't propagate any further */
      }
}

[ i.e., the same way we do it in pick_next_task() ]

then e.g. the following block in schedule()

---
#ifdef CONFIG_SMP
       if (prev->sched_class->pre_schedule)
              prev->sched_class->pre_schedule(rq, prev);
#endif

if (unlikely(!rq->nr_running))
          idle_balance(cpu, rq);
---

would be substituted by:

generic_load_balance(PRE_SCHEDULE, rq, prev);

i.e., the following block


is called from sched_class_fair :: load_balance_fair()
upon getting a PRE_SCHEDULE load-balancing point.

IMHO, it would look nicer this way _BUT_ yeah, this 'full' abstraction
adds additional overhead to the hot-path (which might make it not that
worthy).



-- 
Best regards,
Dmitry Adamushko
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH 1/4] Replace hooks with pre/post schedule and wak..., Dmitry Adamushko, (Tue Dec 11, 6:56 am)