From: tip-bot for Alexander Gordeev <agordeev@redhat.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, agordeev@redhat.com, hpa@zytor.com,
mingo@redhat.com, oleg@redhat.com, tglx@linutronix.de
Subject: [tip:irq/core] genirq: Get rid of unnecessary irqaction field in task_struct
Date: Fri, 9 Mar 2012 13:11:40 -0800 [thread overview]
Message-ID: <tip-4bcdf1d0b652bc33d52f2322b77463e4dc58abf8@git.kernel.org> (raw)
In-Reply-To: <20120309135925.GB2114@dhcp-26-207.brq.redhat.com>
Commit-ID: 4bcdf1d0b652bc33d52f2322b77463e4dc58abf8
Gitweb: http://git.kernel.org/tip/4bcdf1d0b652bc33d52f2322b77463e4dc58abf8
Author: Alexander Gordeev <agordeev@redhat.com>
AuthorDate: Fri, 9 Mar 2012 14:59:26 +0100
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 9 Mar 2012 17:19:08 +0100
genirq: Get rid of unnecessary irqaction field in task_struct
When a new thread handler is created, an irqaction is passed to it as
data. Not only that irqaction is stored in task_struct by the handler
for later use, but also a structure associated with the kernel thread
keeps this value as long as the thread exists.
This fix kicks irqaction out off task_struct. Yes, I introduce new bit
field. But it allows not only to eliminate the duplicate, but also
shortens size of task_struct.
Reported-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
Link: http://lkml.kernel.org/r/20120309135925.GB2114@dhcp-26-207.brq.redhat.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
include/linux/sched.h | 10 +++++-----
kernel/irq/manage.c | 19 +++++++++++--------
2 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 7d379a6..07f537a 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1319,6 +1319,11 @@ struct task_struct {
unsigned sched_reset_on_fork:1;
unsigned sched_contributes_to_load:1;
+#ifdef CONFIG_GENERIC_HARDIRQS
+ /* IRQ handler threads */
+ unsigned irq_thread:1;
+#endif
+
pid_t pid;
pid_t tgid;
@@ -1427,11 +1432,6 @@ struct task_struct {
* mempolicy */
spinlock_t alloc_lock;
-#ifdef CONFIG_GENERIC_HARDIRQS
- /* IRQ handler threads */
- struct irqaction *irqaction;
-#endif
-
/* Protection of the PI data structures: */
raw_spinlock_t pi_lock;
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index c0730ad..0fa3ce9 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -780,7 +780,7 @@ static int irq_thread(void *data)
handler_fn = irq_thread_fn;
sched_setscheduler(current, SCHED_FIFO, ¶m);
- current->irqaction = action;
+ current->irq_thread = 1;
while (!irq_wait_for_interrupt(action)) {
@@ -818,10 +818,10 @@ static int irq_thread(void *data)
irq_finalize_oneshot(desc, action, true);
/*
- * Clear irqaction. Otherwise exit_irq_thread() would make
+ * Clear irq_thread. Otherwise exit_irq_thread() would make
* fuzz about an active irq thread going into nirvana.
*/
- current->irqaction = NULL;
+ current->irq_thread = 0;
return 0;
}
@@ -832,27 +832,30 @@ void exit_irq_thread(void)
{
struct task_struct *tsk = current;
struct irq_desc *desc;
+ struct irqaction *action;
- if (!tsk->irqaction)
+ if (!tsk->irq_thread)
return;
+ action = kthread_data(tsk);
+
printk(KERN_ERR
"exiting task \"%s\" (%d) is an active IRQ thread (irq %d)\n",
- tsk->comm ? tsk->comm : "", tsk->pid, tsk->irqaction->irq);
+ tsk->comm ? tsk->comm : "", tsk->pid, action->irq);
- desc = irq_to_desc(tsk->irqaction->irq);
+ desc = irq_to_desc(action->irq);
/*
* Prevent a stale desc->threads_oneshot. Must be called
* before setting the IRQTF_DIED flag.
*/
- irq_finalize_oneshot(desc, tsk->irqaction, true);
+ irq_finalize_oneshot(desc, action, true);
/*
* Set the THREAD DIED flag to prevent further wakeups of the
* soon to be gone threaded handler.
*/
- set_bit(IRQTF_DIED, &tsk->irqaction->flags);
+ set_bit(IRQTF_DIED, &action->flags);
}
static void irq_setup_forced_threading(struct irqaction *new)
prev parent reply other threads:[~2012-03-09 21:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-09 13:59 [PATCH 2/4] " Alexander Gordeev
2012-03-09 21:11 ` tip-bot for Alexander Gordeev [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-4bcdf1d0b652bc33d52f2322b77463e4dc58abf8@git.kernel.org \
--to=agordeev@redhat.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=oleg@redhat.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome