From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
Steven Rostedt <rostedt@goodmis.org>,
Clark Williams <williams@redhat.com>,
Gregory Haskins <ghaskins@novell.com>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Gautham R Shenoy <ego@in.ibm.com>,
Pekka Enberg <penberg@cs.helsinki.fi>,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: Re: [PATCH -rt 6/5] cpu-hotplug: cpu_down vs preempt-rt
Date: Wed, 11 Jun 2008 08:53:45 +0200 [thread overview]
Message-ID: <1213167225.31518.64.camel@twins> (raw)
In-Reply-To: <20080610111832.969119014@chello.nl>
Because 5/5 has a horrible bug...
We should only do __mmdrop() from rcu, not mmdrop().
---
Index: linux-2.6.24.7.noarch/include/linux/sched.h
===================================================================
--- linux-2.6.24.7.noarch.orig/include/linux/sched.h
+++ linux-2.6.24.7.noarch/include/linux/sched.h
@@ -1832,6 +1832,7 @@ extern struct mm_struct * mm_alloc(void)
/* mmdrop drops the mm and the page tables */
extern void FASTCALL(__mmdrop(struct mm_struct *));
extern void FASTCALL(__mmdrop_delayed(struct mm_struct *));
+extern void FASTCALL(__mmdrop_rcu(struct mm_struct *));
static inline void mmdrop(struct mm_struct * mm)
{
@@ -1845,6 +1846,12 @@ static inline void mmdrop_delayed(struct
__mmdrop_delayed(mm);
}
+static inline void mmdrop_rcu(struct mm_struct * mm)
+{
+ if (atomic_dec_and_test(&mm->mm_count))
+ __mmdrop_rcu(mm);
+}
+
/* mmput gets rid of the mappings and all user-space */
extern void mmput(struct mm_struct *);
/* Grab a reference to a task's mm, if it is not already going away */
Index: linux-2.6.24.7.noarch/kernel/fork.c
===================================================================
--- linux-2.6.24.7.noarch.orig/kernel/fork.c
+++ linux-2.6.24.7.noarch/kernel/fork.c
@@ -431,6 +431,18 @@ void fastcall __mmdrop(struct mm_struct
free_mm(mm);
}
+#ifdef CONFIG_PREEMPT_RT
+static void ___mmdrop_rcu(struct rcu_head *head)
+{
+ __mmdrop(container_of(head, struct mm_struct, rcu_head));
+}
+
+void fastcall __mmdrop_rcu(struct mm_struct *mm)
+{
+ call_rcu_preempt_online(&mm->rcu_head, ___mmdrop_rcu);
+}
+#endif
+
/*
* Decrement the use count and release all resources for an mm.
*/
Index: linux-2.6.24.7.noarch/kernel/sched.c
===================================================================
--- linux-2.6.24.7.noarch.orig/kernel/sched.c
+++ linux-2.6.24.7.noarch/kernel/sched.c
@@ -5888,15 +5888,6 @@ void sched_idle_next(void)
spin_unlock_irqrestore(&rq->lock, flags);
}
-#ifdef CONFIG_PREEMPT_RT
-void mmdrop_rcu(struct rcu_head *head)
-{
- struct mm_struct *mm = container_of(head, struct mm_struct, rcu_head);
-
- mmdrop(mm);
-}
-#endif
-
/*
* Ensures that the idle task is using init_mm right before its cpu goes
* offline.
@@ -5910,7 +5901,7 @@ void idle_task_exit(void)
if (mm != &init_mm)
switch_mm(mm, &init_mm, current);
#ifdef CONFIG_PREEMPT_RT
- call_rcu_preempt_online(&mm->rcu_head, mmdrop_rcu);
+ mmdrop_rcu(mm);
#else
mmdrop(mm);
#endif
prev parent reply other threads:[~2008-06-11 6:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-10 11:12 [PATCH -rt 0/5] hotplug fixes Peter Zijlstra
2008-06-10 11:13 ` [PATCH -rt 1/5] cpu-hotplug: vs slab Peter Zijlstra
2008-06-10 11:13 ` [PATCH -rt 2/5] cpu-hotplug: vs page_alloc Peter Zijlstra
2008-06-10 11:13 ` [PATCH -rt 3/5] cpu-hotplug: cpu_up vs preempt-rt Peter Zijlstra
2008-06-10 11:13 ` [PATCH -rt 4/5] rcu: backport RCU cpu hotplug support Peter Zijlstra
2008-06-10 15:15 ` Paul E. McKenney
2008-06-10 11:13 ` [PATCH -rt 5/5] cpu-hotplug: cpu_down vs preempt-rt Peter Zijlstra
2008-06-10 15:33 ` Paul E. McKenney
2008-06-10 15:51 ` Peter Zijlstra
2008-06-10 16:17 ` Paul E. McKenney
2008-06-11 6:53 ` Peter Zijlstra [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=1213167225.31518.64.camel@twins \
--to=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=ego@in.ibm.com \
--cc=ghaskins@novell.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=paulmck@linux.vnet.ibm.com \
--cc=penberg@cs.helsinki.fi \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=williams@redhat.com \
/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
all inboxes | Powered by JetHome®