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];