Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161290Ab2JXVzq (ORCPT ); Wed, 24 Oct 2012 17:55:46 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:61837 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422670Ab2JXVzl (ORCPT ); Wed, 24 Oct 2012 17:55:41 -0400 From: Juri Lelli To: peterz@infradead.org, tglx@linutronix.de Cc: mingo@redhat.com, rostedt@goodmis.org, oleg@redhat.com, fweisbec@gmail.com, darren@dvhart.com, johan.eker@ericsson.com, p.faure@akatech.ch, linux-kernel@vger.kernel.org, claudio@evidence.eu.com, michael@amarulasolutions.com, fchecconi@gmail.com, tommaso.cucinotta@sssup.it, juri.lelli@gmail.com, nicola.manica@disi.unitn.it, luca.abeni@unitn.it, dhaval.giani@gmail.com, hgu1972@gmail.com, paulmck@linux.vnet.ibm.com, raistlin@linux.it, insop.song@ericsson.com, liming.wang@windriver.com, jkacur@redhat.com, harald.gustafsson@ericsson.com, vincent.guittot@linaro.org Subject: [PATCH 03/16] sched: add sched_class->task_dead. Date: Wed, 24 Oct 2012 14:53:41 -0700 Message-Id: <1351115634-8420-4-git-send-email-juri.lelli@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1351115634-8420-1-git-send-email-juri.lelli@gmail.com> References: <1351115634-8420-1-git-send-email-juri.lelli@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1815 Lines: 49 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 0dd42a0..c8955a2 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1077,6 +1077,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 2d8927f..fc0f7d8 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -1774,6 +1774,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. -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/