diff options
| author | Dario Faggioli <raistlin@linux.it> | 2013-11-07 08:43:35 -0500 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2013-11-27 08:08:50 -0500 |
| commit | e6c390f2dfd04c165ce45b0032f73fba85b1f282 (patch) | |
| tree | b98a8e422ba770e4be78e2b51bf1120122d0394f | |
| parent | 380c9077b38df2962a22f00f21f6cd0db62d3390 (diff) | |
sched: Add sched_class->task_dead() method
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 will be useful for the scheduling classes that want to be notified
when one of their tasks dies, e.g. to perform some cleanup actions,
such as SCHED_DEADLINE.
Signed-off-by: Dario Faggioli <raistlin@linux.it>
Reviewed-by: Paul Turner <pjt@google.com>
Signed-off-by: Juri Lelli <juri.lelli@gmail.com>
Cc: bruce.ashfield@windriver.com
Cc: claudio@evidence.eu.com
Cc: darren@dvhart.com
Cc: dhaval.giani@gmail.com
Cc: fchecconi@gmail.com
Cc: fweisbec@gmail.com
Cc: harald.gustafsson@ericsson.com
Cc: hgu1972@gmail.com
Cc: insop.song@gmail.com
Cc: jkacur@redhat.com
Cc: johan.eker@ericsson.com
Cc: liming.wang@windriver.com
Cc: luca.abeni@unitn.it
Cc: michael@amarulasolutions.com
Cc: nicola.manica@disi.unitn.it
Cc: oleg@redhat.com
Cc: paulmck@linux.vnet.ibm.com
Cc: p.faure@akatech.ch
Cc: rostedt@goodmis.org
Cc: tommaso.cucinotta@sssup.it
Cc: vincent.guittot@linaro.org
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1383831828-15501-2-git-send-email-juri.lelli@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
| -rw-r--r-- | kernel/sched/core.c | 3 | ||||
| -rw-r--r-- | kernel/sched/sched.h | 1 |
2 files changed, 4 insertions, 0 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 19db8f3b0e3b..25b377986547 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
| @@ -2003,6 +2003,9 @@ static void finish_task_switch(struct rq *rq, struct task_struct *prev) | |||
| 2003 | if (unlikely(prev_state == TASK_DEAD)) { | 2003 | if (unlikely(prev_state == TASK_DEAD)) { |
| 2004 | task_numa_free(prev); | 2004 | task_numa_free(prev); |
| 2005 | 2005 | ||
| 2006 | if (prev->sched_class->task_dead) | ||
| 2007 | prev->sched_class->task_dead(prev); | ||
| 2008 | |||
| 2006 | /* | 2009 | /* |
| 2007 | * Remove function-return probe instances associated with this | 2010 | * Remove function-return probe instances associated with this |
| 2008 | * task and put them back on the free list. | 2011 | * task and put them back on the free list. |
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 88c85b21d633..b3b4a4953efc 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h | |||
| @@ -1023,6 +1023,7 @@ struct sched_class { | |||
| 1023 | void (*set_curr_task) (struct rq *rq); | 1023 | void (*set_curr_task) (struct rq *rq); |
| 1024 | void (*task_tick) (struct rq *rq, struct task_struct *p, int queued); | 1024 | void (*task_tick) (struct rq *rq, struct task_struct *p, int queued); |
| 1025 | void (*task_fork) (struct task_struct *p); | 1025 | void (*task_fork) (struct task_struct *p); |
| 1026 | void (*task_dead) (struct task_struct *p); | ||
| 1026 | 1027 | ||
| 1027 | void (*switched_from) (struct rq *this_rq, struct task_struct *task); | 1028 | void (*switched_from) (struct rq *this_rq, struct task_struct *task); |
| 1028 | void (*switched_to) (struct rq *this_rq, struct task_struct *task); | 1029 | void (*switched_to) (struct rq *this_rq, struct task_struct *task); |
