Messages in this thread Patch in this message | | | From | Juri Lelli <> | Subject | [PATCH 01/16] sched: add sched_class->task_dead. | Date | Fri, 6 Apr 2012 09:14:26 +0200 |
| |
From: Dario Faggioli <raistlin@linux.it>
Add a new function to the scheduling class interface. It is called at the end of a context switch, if the prev task is in TASK_DEAD state.
It might be useful for the scheduling classes that want to be notified when one of their task dies, e.g. to perform some cleanup actions.
Signed-off-by: Dario Faggioli <raistlin@linux.it> Signed-off-by: Juri Lelli <juri.lelli@gmail.com> --- include/linux/sched.h | 1 + kernel/sched.c | 3 +++ 2 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/include/linux/sched.h b/include/linux/sched.h index 1f6b11a..ddfc4dc 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1116,6 +1116,7 @@ struct sched_class { void (*set_curr_task) (struct rq *rq); void (*task_tick) (struct rq *rq, struct task_struct *p, int queued); void (*task_fork) (struct task_struct *p); + void (*task_dead) (struct task_struct *p); void (*switched_from) (struct rq *this_rq, struct task_struct *task); void (*switched_to) (struct rq *this_rq, struct task_struct *task); diff --git a/kernel/sched.c b/kernel/sched.c index 1cc706d..4c8d1c3 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -3219,6 +3219,9 @@ static void finish_task_switch(struct rq *rq, struct task_struct *prev) if (mm) mmdrop_delayed(mm); if (unlikely(prev_state == TASK_DEAD)) { + if (prev->sched_class->task_dead) + prev->sched_class->task_dead(prev); + /* * Remove function-return probe instances associated with this * task and put them back on the free list. -- 1.7.5.4
| |