From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Gleb Natapov <gleb@redhat.com>
Cc: linux-kernel@vger.kernel.org, avi@redhat.com,
mtosatti@redhat.com, kvm@vger.kernel.org
Subject: Re: [PATCH 1/2] rcu: export rcu_note_context_switch() function
Date: Sat, 30 Apr 2011 05:59:28 -0700 [thread overview]
Message-ID: <20110430125928.GJ2297@linux.vnet.ibm.com> (raw)
In-Reply-To: <20110429180239.GA32566@redhat.com>
On Fri, Apr 29, 2011 at 09:02:39PM +0300, Gleb Natapov wrote:
> On Fri, Apr 29, 2011 at 01:39:04AM -0700, Paul E. McKenney wrote:
> > On Fri, Apr 29, 2011 at 01:36:18AM -0700, Paul E. McKenney wrote:
> > > On Thu, Apr 28, 2011 at 12:52:02PM +0300, Gleb Natapov wrote:
> > >
> > > Hmmm.... This is interesting. KVM being a module, we either expand
> > > TINY_RCU's size a bit by making rcu_note_context_switch() be a real
> > > function in rcutiny.c and adding an export, or we expand it by adding
> > > two exports.
> > >
> > > I would like to solve this without making TINY_RCU larger, and preferably
> > > by making it smaller. Any ideas come to mind? (Other than making
> > > KVM depend on CONFIG_SMP, which sounds too much like throwing out the
> > > baby with the bathwater.)
> >
> > Nothing quite like hitting "send" to make an idea show up...
> >
> > In a UP kernel, does it actually help anything to have KVM
> > tell RCU about executing in a guest? If not, could we have a
> > rcu_note_context_switch_kvm() that is a static inline empty function in
> > TINY_RCU and maps to rcu_note_context_switch() for TREE_RCU?
> >
> That will work, but does making rcu_note_context_switch() out of line
> actually increase kernel size? The function is called in two places
> currently, so by making it out of line we make two calling site smaller.
> Will measure it next week.
One thing to keep in mind... Calling an out-of-line function from
KVM requires an export, each of which significantly increases TINY_RCU's
memory footprint.
Thanx, Paul
> > > > Signed-off-by: Gleb Natapov <gleb@redhat.com>
> > > > ---
> > > > include/linux/rcutiny.h | 6 +-----
> > > > kernel/rcutiny.c | 7 +++++++
> > > > kernel/rcutree.c | 1 +
> > > > 3 files changed, 9 insertions(+), 5 deletions(-)
> > > >
> > > > diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
> > > > index 30ebd7c..8e5f7cf 100644
> > > > --- a/include/linux/rcutiny.h
> > > > +++ b/include/linux/rcutiny.h
> > > > @@ -93,11 +93,7 @@ static inline int rcu_needs_cpu(int cpu)
> > > >
> > > > #endif /* #else #ifdef CONFIG_TINY_RCU */
> > > >
> > > > -static inline void rcu_note_context_switch(int cpu)
> > > > -{
> > > > - rcu_sched_qs(cpu);
> > > > - rcu_preempt_note_context_switch();
> > > > -}
> > > > +extern void rcu_note_context_switch(int cpu);
> > > >
> > > > /*
> > > > * Return the number of grace periods.
> > > > diff --git a/kernel/rcutiny.c b/kernel/rcutiny.c
> > > > index 0c343b9..3d715a4 100644
> > > > --- a/kernel/rcutiny.c
> > > > +++ b/kernel/rcutiny.c
> > > > @@ -78,6 +78,13 @@ void rcu_exit_nohz(void)
> > > >
> > > > #endif /* #ifdef CONFIG_NO_HZ */
> > > >
> > > > +void rcu_note_context_switch(int cpu)
> > > > +{
> > > > + rcu_sched_qs(cpu);
> > > > + rcu_preempt_note_context_switch();
> > > > +}
> > > > +EXPORT_SYMBOL_GPL(rcu_note_context_switch);
> > > > +
> > > > /*
> > > > * Helper function for rcu_qsctr_inc() and rcu_bh_qsctr_inc().
> > > > * Also disable irqs to avoid confusion due to interrupt handlers
> > > > 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.2.3
> > > >
> > > > --
> > > > 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/
>
> --
> Gleb.
next prev parent reply other threads:[~2011-04-30 12:59 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-28 9:52 [PATCH 0/2] make kvm guest mode to be rcu quiescent state Gleb Natapov
2011-04-28 9:52 ` [PATCH 1/2] rcu: export rcu_note_context_switch() function Gleb Natapov
2011-04-28 10:01 ` Avi Kivity
2011-04-28 10:11 ` Gleb Natapov
2011-04-29 8:36 ` Paul E. McKenney
2011-04-29 8:39 ` Paul E. McKenney
2011-04-29 18:02 ` Gleb Natapov
2011-04-29 18:23 ` Gleb Natapov
2011-04-30 12:59 ` Paul E. McKenney [this message]
2011-04-30 19:43 ` Avi Kivity
2011-05-02 10:56 ` Gleb Natapov
2011-05-02 13:36 ` Paul E. McKenney
2011-05-02 14:10 ` Gleb Natapov
2011-05-03 6:25 ` Paul E. McKenney
2011-05-04 13:10 ` Gleb Natapov
2011-04-28 9:52 ` [PATCH 2/2] KVM: make guest mode entry to be rcu quiescent state Gleb Natapov
2011-05-03 13:13 ` Marcelo Tosatti
2011-05-03 13:20 ` Avi Kivity
2011-05-03 13:21 ` Gleb Natapov
2011-05-03 13:29 ` Marcelo Tosatti
2011-05-03 13:39 ` Gleb Natapov
2011-05-03 15:42 ` Marcelo Tosatti
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=20110430125928.GJ2297@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=avi@redhat.com \
--cc=gleb@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mtosatti@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;
as well as URLs for NNTP newsgroup(s).