[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4B019A76.2080706@redhat.com>
Date: Mon, 16 Nov 2009 20:31:18 +0200
From: Avi Kivity <avi@...hat.com>
To: Tejun Heo <tj@...nel.org>
CC: linux-kernel@...r.kernel.org, jeff@...zik.org, mingo@...e.hu,
akpm@...ux-foundation.org, jens.axboe@...cle.com,
rusty@...tcorp.com.au, cl@...ux-foundation.org,
dhowells@...hat.com, arjan@...ux.intel.com,
torvalds@...ux-foundation.org, peterz@...radead.org,
andi@...stfloor.org, fweisbec@...il.com
Subject: Re: [PATCH 04/21] sched: implement scheduler notifiers
On 11/16/2009 07:15 PM, Tejun Heo wrote:
> Implement scheduler notifiers. This is superset of preempt notifiers
> which will be removed in favor of new notifiers. Four notifications
> are defined - activated, deactivated, in and out. In and out are
> identical to preempt notifiers. Activated and deactivated are called
> when a task's readiness to run changes. The first three are always
> called under rq lock. Out may not be called under rq lock depending
> on architecture.
>
> The notifier block contains union of all four callbacks to avoid
> defining separate interface for each.
>
> +
> +struct sched_notifier {
> + struct hlist_node link;
> + union {
> + void (*activated)(struct sched_notifier *n, bool wakeup);
> + void (*deactivated)(struct sched_notifier *n, bool sleep);
> + void (*in)(struct sched_notifier *n, struct task_struct *prev);
> + void (*out)(struct sched_notifier *n, struct task_struct *next);
> + };
> +};
> +
>
> struct task_struct {
> @@ -1237,6 +1268,8 @@ struct task_struct {
> /* list of struct preempt_notifier: */
> struct hlist_head preempt_notifiers;
> #endif
> + /* sched notifiers */
> + struct hlist_head notifiers[SCHED_NR_NOTIFIERS];
>
>
Four hlist_heads (64 bytes) is pretty heavy for this. I having all
members present in sched_notifier (instead of a union) and calling a
callback if it is not NULL. This reduces the overhead to 16 bytes at
the expense of an extra check for sched_notifier users.
Besides this, is there any difference to preempt_notifiers? if not we
can just add the new members and rename.
--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists