From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Alexander Gordeev <agordeev@redhat.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] rcu: Remove redundant rcu_is_cpu_rrupt_from_idle() from tiny RCU
Date: Fri, 31 Oct 2014 10:36:03 -0700 [thread overview]
Message-ID: <20141031173603.GA15718@linux.vnet.ibm.com> (raw)
In-Reply-To: <20141031145504.GC18126@agordeev.usersys.redhat.com>
On Fri, Oct 31, 2014 at 02:55:05PM +0000, Alexander Gordeev wrote:
> Let's start assuming that something in the idle loop posts a callback,
> and scheduling-clock interrupt occurs:
>
> 1. The system is idle and stays that way, no runnable tasks.
>
> 2. Scheduling-clock interrupt occurs, rcu_check_callbacks() is called
> as result, which in turn calls rcu_is_cpu_rrupt_from_idle().
>
> 3. rcu_is_cpu_rrupt_from_idle() reports the CPU was interrupted from
> idle, which results in rcu_sched_qs() call, which does a
> raise_softirq(RCU_SOFTIRQ).
>
> 4. Upon return from interrupt, rcu_irq_exit() is invoked, which calls
> rcu_idle_enter_common(), which in turn calls rcu_sched_qs() again,
> which does another raise_softirq(RCU_SOFTIRQ).
>
> 5. The softirq happens shortly and invokes rcu_process_callbacks(),
> which invokes __rcu_process_callbacks().
>
> 6. So now callbacks can be invoked. At least they can be if
> ->donetail has been updated. Which it will have been because
> rcu_sched_qs() invokes rcu_qsctr_help().
>
> In the described scenario rcu_sched_qs() and raise_softirq(RCU_SOFTIRQ)
> get called twice in steps 3 and 4. This redundancy could be eliminated
> by removing rcu_is_cpu_rrupt_from_idle() function.
>
> Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Queued for 3.20, thank you!
Thanx, Paul
> ---
> kernel/rcu/tiny.c | 12 +-----------
> 1 file changed, 1 insertion(+), 11 deletions(-)
>
> diff --git a/kernel/rcu/tiny.c b/kernel/rcu/tiny.c
> index c0623fc..0bfb3b9 100644
> --- a/kernel/rcu/tiny.c
> +++ b/kernel/rcu/tiny.c
> @@ -186,16 +186,6 @@ EXPORT_SYMBOL(__rcu_is_watching);
> #endif /* defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) */
>
> /*
> - * Test whether the current CPU was interrupted from idle. Nested
> - * interrupts don't count, we must be running at the first interrupt
> - * level.
> - */
> -static int rcu_is_cpu_rrupt_from_idle(void)
> -{
> - return rcu_dynticks_nesting <= 1;
> -}
> -
> -/*
> * Helper function for rcu_sched_qs() and rcu_bh_qs().
> * Also irqs are disabled to avoid confusion due to interrupt handlers
> * invoking call_rcu().
> @@ -250,7 +240,7 @@ void rcu_bh_qs(void)
> void rcu_check_callbacks(int user)
> {
> RCU_TRACE(check_cpu_stalls());
> - if (user || rcu_is_cpu_rrupt_from_idle())
> + if (user)
> rcu_sched_qs();
> else if (!in_softirq())
> rcu_bh_qs();
> --
> 1.8.3.1
>
> --
> Regards,
> Alexander Gordeev
> agordeev@redhat.com
> --
> 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/
>
prev parent reply other threads:[~2014-10-31 17:36 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-29 11:07 [PATCH] rcu: Remove redundant rcu_is_cpu_rrupt_from_idle() function Alexander Gordeev
2014-10-29 12:47 ` Paul E. McKenney
2014-10-29 13:45 ` Alexander Gordeev
2014-10-29 14:34 ` Paul E. McKenney
2014-10-29 15:16 ` Alexander Gordeev
2014-10-29 15:46 ` Paul E. McKenney
2014-10-29 21:09 ` Alexander Gordeev
2014-10-30 0:05 ` Paul E. McKenney
2014-10-30 17:54 ` Alexander Gordeev
2014-10-30 20:43 ` Paul E. McKenney
2014-10-30 21:54 ` Alexander Gordeev
2014-10-31 3:45 ` Paul E. McKenney
2014-10-31 14:53 ` Alexander Gordeev
2014-10-31 14:55 ` [PATCH v2] rcu: Remove redundant rcu_is_cpu_rrupt_from_idle() from tiny RCU Alexander Gordeev
2014-10-31 17:36 ` Paul E. McKenney [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=20141031173603.GA15718@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=agordeev@redhat.com \
--cc=linux-kernel@vger.kernel.org \
/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