[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPM31R+=zRB7WJTSkYCLmo1cvPLV-6ZuedJLts+vb5r4hKJhYg@mail.gmail.com>
Date: Mon, 11 Nov 2013 20:17:20 -0800
From: Paul Turner <pjt@...gle.com>
To: Juri Lelli <juri.lelli@...il.com>
Cc: Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, rostedt <rostedt@...dmis.org>,
Oleg Nesterov <oleg@...hat.com>,
Frédéric Weisbecker <fweisbec@...il.com>,
darren@...art.com, johan.eker@...csson.com, p.faure@...tech.ch,
LKML <linux-kernel@...r.kernel.org>, claudio@...dence.eu.com,
michael@...rulasolutions.com, fchecconi@...il.com,
tommaso.cucinotta@...up.it, nicola.manica@...i.unitn.it,
luca.abeni@...tn.it, Dhaval Giani <dhaval.giani@...il.com>,
hgu1972@...il.com, Paul McKenney <paulmck@...ux.vnet.ibm.com>,
raistlin@...ux.it, insop.song@...il.com, liming.wang@...driver.com,
jkacur@...hat.com, harald.gustafsson@...csson.com,
Vincent Guittot <vincent.guittot@...aro.org>,
bruce.ashfield@...driver.com
Subject: Re: [PATCH 01/14] sched: add sched_class->task_dead.
On Thu, Nov 7, 2013 at 5:43 AM, Juri Lelli <juri.lelli@...il.com> wrote:
> From: Dario Faggioli <raistlin@...ux.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.
We could also usefully use this within SCHED_FAIR to remove a task's
load contribution when it completes.
>
> Signed-off-by: Dario Faggioli <raistlin@...ux.it>
> Signed-off-by: Juri Lelli <juri.lelli@...il.com>
> ---
> kernel/sched/core.c | 3 +++
> kernel/sched/sched.h | 1 +
> 2 files changed, 4 insertions(+)
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 5ac63c9..850a02c 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -1890,6 +1890,9 @@ static void finish_task_switch(struct rq *rq, struct task_struct *prev)
> if (mm)
> mmdrop(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.
> diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
> index b3c5653..64eda5c 100644
> --- a/kernel/sched/sched.h
> +++ b/kernel/sched/sched.h
> @@ -992,6 +992,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);
Reviewed-by: Paul Turner <pjt@...gle.com>
> --
> 1.7.9.5
>
> --
> 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/
--
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