[lkml]   [2013]   [Feb]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Patch in this message
    Subject[PATCH 01/14] sched: add sched_class->task_dead.
    From: Dario Faggioli <>

    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 <>
    Signed-off-by: Juri Lelli <>
    include/linux/sched.h | 1 +
    kernel/sched/core.c | 3 +++
    2 files changed, 4 insertions(+)

    diff --git a/include/linux/sched.h b/include/linux/sched.h
    index d211247..640c741 100644
    --- a/include/linux/sched.h
    +++ b/include/linux/sched.h
    @@ -1104,6 +1104,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/core.c b/kernel/sched/core.c
    index 26058d0..7e99105 100644
    --- a/kernel/sched/core.c
    +++ b/kernel/sched/core.c
    @@ -1843,6 +1843,9 @@ static void finish_task_switch(struct rq *rq, struct task_struct *prev)
    if (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.

     \ /
      Last update: 2013-02-11 20:42    [W:0.023 / U:0.116 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site