Hi,
Does this seem like anything that has even a remote possibility of entering
the Kernel? It's not a strict requirement for kmemcheck, but it's extremely
nice compared to the 1 Hz timer I've been using till now.
(Again, I can put it in my queue for now, but it would be nice to have the
necessary Signed-off-bys for when it gets merged. I mean, _if_ it gets
merged...)
Vegard
From: Vegard Nossum <vegard.nossum@gmail.com>
Date: Wed, 21 May 2008 22:53:13 +0200
Subject: [PATCH] tasklets: new tasklet scheduling function
Rationale: kmemcheck needs to be able to schedule a tasklet without
touching any dynamically allocated memory _at_ _all_ (since that would
lead to a recursive page fault). This tasklet is used for writing the
error reports to the kernel log.
The new scheduling function avoids touching any other tasklets by
inserting the new tasklist as the head of the "tasklet_hi" list instead
of on the tail.
Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
---
include/linux/interrupt.h | 14 ++++++++++++++
kernel/softirq.c | 13 +++++++++++++
2 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index f1fc747..ce0598b 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -377,6 +377,20 @@ static inline void tasklet_hi_schedule(struct tasklet_struct *t)
__tasklet_hi_schedule(t);
}
+extern void __tasklet_hi_schedule_first(struct tasklet_struct *t);
+
+/*
+ * This version avoids touching any other tasklets. Needed for kmemcheck
+ * in order not to take any page faults while enqueueing this tasklet;
+ * consider VERY carefully whether you really need this or
+ * tasklet_hi_schedule()...
+ */
+static inline void tasklet_hi_schedule_first(struct tasklet_struct *t)
+{
+ if (!test_and_set_bit(TASKLET_STATE_SCHED, &t->state))
+ __tasklet_hi_schedule_first(t);
+}
+
static inline void tasklet_disable_nosync(struct tasklet_struct *t)
{
diff --git a/kernel/softirq.c b/kernel/softirq.c
index 36e0617..b2edfbe 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -393,6 +393,19 @@ void __tasklet_hi_schedule(struct tasklet_struct *t)
EXPORT_SYMBOL(__tasklet_hi_schedule);
+void __tasklet_hi_schedule_first(struct tasklet_struct *t)
+{
+ unsigned long flags;
+
+ local_irq_save(flags);
+ t->next = __get_cpu_var(tasklet_hi_vec).head;
+ __get_cpu_var(tasklet_hi_vec).head = t;
+ raise_softirq_irqoff(TASKLET_SOFTIRQ);
+ local_irq_restore(flags);
+}
+
+EXPORT_SYMBOL(__tasklet_hi_schedule_first);
+
static void tasklet_action(struct softirq_action *a)
{
struct tasklet_struct *list;
--
1.5.4.1
--
| Alan Cox | [PATCH 00/76] Queued TTY Patches |
| Nick Piggin | [patch 1/6] mm: debug check for the fault vs invalidate race |
| Andi Kleen | [PATCH] [1/22] x86_64: dma_ops as const |
| Linus Torvalds | Linux 2.6.27-rc8 |
git: | |
| Jeff King | Re: What's cooking in git/spearce.git (topics) |
| Jeff King | Re: [RFC] origin link for cherry-pick and revert |
| Matt Seitz (matseitz) | Symbolic link documentation |
| Jon Smirl | Huge win, compressing a window of delta runs as a unit |
| Richard Stallman | Real men don't attack straw men |
| Leon Dippenaar | New tcp stack attack |
| Nuno Magalhães | Can't scp, ssh is slow to authenticate. |
| Brandon Lee | DELL PERC 5iR slow performance |
| KOSAKI Motohiro | [bug?] tg3: Failed to load firmware "tigon/tg3_tso.bin" |
| Denys Vlasenko | Re: bnx2 dirver's firmware images |
| Pavel Emelyanov | [PATCH 0/8] Cleanup/fix the sk_alloc() call |
| Kok, Auke | Re: [PATCH] drivers/net: remove network drivers' last few uses of IRQF_SAMPLE_RANDOM |
