diff mbox

[1/2] rcu: provide rcu_virt_note_context_switch() function.

Message ID 1304515864-17105-2-git-send-email-gleb@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Gleb Natapov May 4, 2011, 1:31 p.m. UTC
Provide rcu_virt_note_context_switch() for vitalization use to note
quiescent state during guest entry.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
 include/linux/rcutiny.h |    8 ++++++++
 include/linux/rcutree.h |   10 ++++++++++
 kernel/rcutree.c        |    1 +
 3 files changed, 19 insertions(+), 0 deletions(-)

Comments

Paul E. McKenney May 4, 2011, 4:35 p.m. UTC | #1
On Wed, May 04, 2011 at 04:31:03PM +0300, Gleb Natapov wrote:
> Provide rcu_virt_note_context_switch() for vitalization use to note
> quiescent state during guest entry.

Very good, queued on -rcu.

Unless you tell me otherwise, I will assume that you want to carry the
patch modifying KVM to use this.

							Thanx, Paul

> Signed-off-by: Gleb Natapov <gleb@redhat.com>
> ---
>  include/linux/rcutiny.h |    8 ++++++++
>  include/linux/rcutree.h |   10 ++++++++++
>  kernel/rcutree.c        |    1 +
>  3 files changed, 19 insertions(+), 0 deletions(-)
> 
> diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
> index 30ebd7c..52b3e02 100644
> --- a/include/linux/rcutiny.h
> +++ b/include/linux/rcutiny.h
> @@ -100,6 +100,14 @@ static inline void rcu_note_context_switch(int cpu)
>  }
> 
>  /*
> + * Take advantage of the fact that there is only one CPU, which
> + * allows us to ignore virtualization-based context switches.
> + */
> +static inline void rcu_virt_note_context_switch(int cpu)
> +{
> +}
> +
> +/*
>   * Return the number of grace periods.
>   */
>  static inline long rcu_batches_completed(void)
> diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
> index 3a93348..b2a906e 100644
> --- a/include/linux/rcutree.h
> +++ b/include/linux/rcutree.h
> @@ -35,6 +35,16 @@ extern void rcu_note_context_switch(int cpu);
>  extern int rcu_needs_cpu(int cpu);
>  extern void rcu_cpu_stall_reset(void);
> 
> +/*
> + * Note a virtualization-based context switch.  This is simply a
> + * wrapper around rcu_note_context_switch(), which allows TINY_RCU
> + * to save a few bytes.
> + */
> +static inline void rcu_virt_note_context_switch(int cpu)
> +{
> +	rcu_note_context_switch(cpu);
> +}
> +
>  #ifdef CONFIG_TREE_PREEMPT_RCU
> 
>  extern void exit_rcu(void);
> diff --git a/kernel/rcutree.c b/kernel/rcutree.c
> index dd4aea8..0837d63 100644
> --- a/kernel/rcutree.c
> +++ b/kernel/rcutree.c
> @@ -124,6 +124,7 @@ void rcu_note_context_switch(int cpu)
>  	rcu_sched_qs(cpu);
>  	rcu_preempt_note_context_switch(cpu);
>  }
> +EXPORT_SYMBOL_GPL(rcu_note_context_switch);
> 
>  #ifdef CONFIG_NO_HZ
>  DEFINE_PER_CPU(struct rcu_dynticks, rcu_dynticks) = {
> -- 
> 1.7.4.4
> 
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Avi Kivity May 9, 2011, 8:51 a.m. UTC | #2
On 05/04/2011 07:35 PM, Paul E. McKenney wrote:
> On Wed, May 04, 2011 at 04:31:03PM +0300, Gleb Natapov wrote:
> >  Provide rcu_virt_note_context_switch() for vitalization use to note
> >  quiescent state during guest entry.
>
> Very good, queued on -rcu.
>
> Unless you tell me otherwise, I will assume that you want to carry the
> patch modifying KVM to use this.

Is -rcu a fast-forward-only tree (like tip)?  If so I'll merge it and 
apply patch 2.
Paul E. McKenney May 9, 2011, 12:16 p.m. UTC | #3
On Mon, May 09, 2011 at 11:51:34AM +0300, Avi Kivity wrote:
> On 05/04/2011 07:35 PM, Paul E. McKenney wrote:
> >On Wed, May 04, 2011 at 04:31:03PM +0300, Gleb Natapov wrote:
> >>  Provide rcu_virt_note_context_switch() for vitalization use to note
> >>  quiescent state during guest entry.
> >
> >Very good, queued on -rcu.
> >
> >Unless you tell me otherwise, I will assume that you want to carry the
> >patch modifying KVM to use this.
> 
> Is -rcu a fast-forward-only tree (like tip)?  If so I'll merge it
> and apply patch 2.

Yep, -rcu is subject to rebase and feeds into -tip.  The patch is
SHA 29ce831000081dd757d3116bf774aafffc4b6b20 in

	git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-2.6-rcu.git

Branch is rcu/next.  My guess is that this commit will show up in
-tip soon.

							Thanx, Paul
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
index 30ebd7c..52b3e02 100644
--- a/include/linux/rcutiny.h
+++ b/include/linux/rcutiny.h
@@ -100,6 +100,14 @@  static inline void rcu_note_context_switch(int cpu)
 }
 
 /*
+ * Take advantage of the fact that there is only one CPU, which
+ * allows us to ignore virtualization-based context switches.
+ */
+static inline void rcu_virt_note_context_switch(int cpu)
+{
+}
+
+/*
  * Return the number of grace periods.
  */
 static inline long rcu_batches_completed(void)
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
index 3a93348..b2a906e 100644
--- a/include/linux/rcutree.h
+++ b/include/linux/rcutree.h
@@ -35,6 +35,16 @@  extern void rcu_note_context_switch(int cpu);
 extern int rcu_needs_cpu(int cpu);
 extern void rcu_cpu_stall_reset(void);
 
+/*
+ * Note a virtualization-based context switch.  This is simply a
+ * wrapper around rcu_note_context_switch(), which allows TINY_RCU
+ * to save a few bytes.
+ */
+static inline void rcu_virt_note_context_switch(int cpu)
+{
+	rcu_note_context_switch(cpu);
+}
+
 #ifdef CONFIG_TREE_PREEMPT_RCU
 
 extern void exit_rcu(void);
diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index dd4aea8..0837d63 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -124,6 +124,7 @@  void rcu_note_context_switch(int cpu)
 	rcu_sched_qs(cpu);
 	rcu_preempt_note_context_switch(cpu);
 }
+EXPORT_SYMBOL_GPL(rcu_note_context_switch);
 
 #ifdef CONFIG_NO_HZ
 DEFINE_PER_CPU(struct rcu_dynticks, rcu_dynticks) = {