From: "Dmitry Adamushko" <dmitry.adamushko@gmail.com>
To: "Steven Rostedt" <rostedt@goodmis.org>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
"Ingo Molnar" <mingo@elte.hu>,
vatsa@linux.vnet.ibm.com, "Balbir Singh" <balbir@in.ibm.com>,
"Peter Zijlstra" <a.p.zijlstra@chello.nl>,
"Gregory Haskins" <ghaskins@novell.com>,
"Steven Rostedt" <srostedt@goodmis.org>
Subject: Re: [PATCH 1/4] Replace hooks with pre/post schedule and wakeup methods
Date: Tue, 11 Dec 2007 11:56:32 +0100 [thread overview]
Message-ID: <b647ffbd0712110256o587b7e40s4161b31577a2c0ea@mail.gmail.com> (raw)
In-Reply-To: <20071211023610.608838664@goodmis.org>
On 11/12/2007, Steven Rostedt <rostedt@goodmis.org> wrote:
> To make the main sched.c code more agnostic to the schedule classes.
> Instead of having specific hooks in the schedule code for the RT class
> balancing. They are replaced with a pre_schedule, post_schedule
> and task_wake_up methods. These methods may be used by any of the classes
> but currently, only the sched_rt class implements them.
>
> Signed-off-by: Steven Rostedt <srostedt@goodmis.org>
> ---
> include/linux/sched.h | 3 +++
> kernel/sched.c | 20 ++++++++++++++++----
> kernel/sched_rt.c | 17 +++++++----------
> 3 files changed, 26 insertions(+), 14 deletions(-)
>
> Index: linux-sched/include/linux/sched.h
> ===================================================================
> --- linux-sched.orig/include/linux/sched.h 2007-12-10 20:39:11.000000000 -0500
> +++ linux-sched/include/linux/sched.h 2007-12-10 20:39:14.000000000 -0500
> @@ -848,6 +848,9 @@ struct sched_class {
> int (*move_one_task) (struct rq *this_rq, int this_cpu,
> struct rq *busiest, struct sched_domain *sd,
> enum cpu_idle_type idle);
> + void (*pre_schedule) (struct rq *this_rq, struct task_struct *task);
> + void (*post_schedule) (struct rq *this_rq);
> + void (*task_wake_up) (struct rq *this_rq, struct task_struct *task);
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
> if (unlikely(!rq->nr_running))
> idle_balance(cpu, rq);
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
parent reply other threads:[~2007-12-11 10:56 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20071211023610.608838664@goodmis.org>]
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=b647ffbd0712110256o587b7e40s4161b31577a2c0ea@mail.gmail.com \
--to=dmitry.adamushko@gmail.com \
--cc=a.p.zijlstra@chello.nl \
--cc=balbir@in.ibm.com \
--cc=ghaskins@novell.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rostedt@goodmis.org \
--cc=srostedt@goodmis.org \
--cc=vatsa@linux.vnet.ibm.com \
/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 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®