diff mbox

[tip/core/urgent,1/2] rcu: Prevent soft-lockup complaints about no-CBs CPUs

Message ID 1357405131-13421-1-git-send-email-paulmck@linux.vnet.ibm.com
State Accepted
Commit 353af9c9a866b07492b15a4efd18ec93123d3a1d
Headers show

Commit Message

Paul E. McKenney Jan. 5, 2013, 4:58 p.m. UTC
From: Paul Gortmaker <paul.gortmaker@windriver.com>

The wait_event() at the head of the rcu_nocb_kthread() can result in
soft-lockup complaints if the CPU in question does not register RCU
callbacks for an extended period.  This commit therefore changes
the wait_event() to a wait_event_interruptible().

Reported-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 kernel/rcutree_plugin.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Comments

Frederic Weisbecker Jan. 5, 2013, 5:21 p.m. UTC | #1
Hi Paul,

2013/1/5 Paul E. McKenney <paulmck@linux.vnet.ibm.com>:
> From: Paul Gortmaker <paul.gortmaker@windriver.com>
>
> The wait_event() at the head of the rcu_nocb_kthread() can result in
> soft-lockup complaints if the CPU in question does not register RCU
> callbacks for an extended period.  This commit therefore changes
> the wait_event() to a wait_event_interruptible().
>
> Reported-by: Frederic Weisbecker <fweisbec@gmail.com>
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> ---
>  kernel/rcutree_plugin.h |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/kernel/rcutree_plugin.h b/kernel/rcutree_plugin.h
> index f6e5ec2..43dba2d 100644
> --- a/kernel/rcutree_plugin.h
> +++ b/kernel/rcutree_plugin.h
> @@ -2366,10 +2366,11 @@ static int rcu_nocb_kthread(void *arg)
>         for (;;) {
>                 /* If not polling, wait for next batch of callbacks. */
>                 if (!rcu_nocb_poll)
> -                       wait_event(rdp->nocb_wq, rdp->nocb_head);
> +                       wait_event_interruptible(rdp->nocb_wq, rdp->nocb_head);
>                 list = ACCESS_ONCE(rdp->nocb_head);
>                 if (!list) {
>                         schedule_timeout_interruptible(1);
> +                       flush_signals(current);

Why is that needed?
Paul E. McKenney Jan. 5, 2013, 5:54 p.m. UTC | #2
On Sat, Jan 05, 2013 at 06:21:01PM +0100, Frederic Weisbecker wrote:
> Hi Paul,
> 
> 2013/1/5 Paul E. McKenney <paulmck@linux.vnet.ibm.com>:
> > From: Paul Gortmaker <paul.gortmaker@windriver.com>
> >
> > The wait_event() at the head of the rcu_nocb_kthread() can result in
> > soft-lockup complaints if the CPU in question does not register RCU
> > callbacks for an extended period.  This commit therefore changes
> > the wait_event() to a wait_event_interruptible().
> >
> > Reported-by: Frederic Weisbecker <fweisbec@gmail.com>
> > Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
> > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > ---
> >  kernel/rcutree_plugin.h |    3 ++-
> >  1 files changed, 2 insertions(+), 1 deletions(-)
> >
> > diff --git a/kernel/rcutree_plugin.h b/kernel/rcutree_plugin.h
> > index f6e5ec2..43dba2d 100644
> > --- a/kernel/rcutree_plugin.h
> > +++ b/kernel/rcutree_plugin.h
> > @@ -2366,10 +2366,11 @@ static int rcu_nocb_kthread(void *arg)
> >         for (;;) {
> >                 /* If not polling, wait for next batch of callbacks. */
> >                 if (!rcu_nocb_poll)
> > -                       wait_event(rdp->nocb_wq, rdp->nocb_head);
> > +                       wait_event_interruptible(rdp->nocb_wq, rdp->nocb_head);
> >                 list = ACCESS_ONCE(rdp->nocb_head);
> >                 if (!list) {
> >                         schedule_timeout_interruptible(1);
> > +                       flush_signals(current);
> 
> Why is that needed?

To satisfy my paranoia.  ;-)  And in case someone ever figures out some
way to send a signal to a kthread.

							Thanx, Paul
Frederic Weisbecker Jan. 5, 2013, 6:29 p.m. UTC | #3
2013/1/5 Paul E. McKenney <paulmck@linux.vnet.ibm.com>:
> On Sat, Jan 05, 2013 at 06:21:01PM +0100, Frederic Weisbecker wrote:
>> Hi Paul,
>>
>> 2013/1/5 Paul E. McKenney <paulmck@linux.vnet.ibm.com>:
>> > From: Paul Gortmaker <paul.gortmaker@windriver.com>
>> >
>> > The wait_event() at the head of the rcu_nocb_kthread() can result in
>> > soft-lockup complaints if the CPU in question does not register RCU
>> > callbacks for an extended period.  This commit therefore changes
>> > the wait_event() to a wait_event_interruptible().
>> >
>> > Reported-by: Frederic Weisbecker <fweisbec@gmail.com>
>> > Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
>> > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
>> > ---
>> >  kernel/rcutree_plugin.h |    3 ++-
>> >  1 files changed, 2 insertions(+), 1 deletions(-)
>> >
>> > diff --git a/kernel/rcutree_plugin.h b/kernel/rcutree_plugin.h
>> > index f6e5ec2..43dba2d 100644
>> > --- a/kernel/rcutree_plugin.h
>> > +++ b/kernel/rcutree_plugin.h
>> > @@ -2366,10 +2366,11 @@ static int rcu_nocb_kthread(void *arg)
>> >         for (;;) {
>> >                 /* If not polling, wait for next batch of callbacks. */
>> >                 if (!rcu_nocb_poll)
>> > -                       wait_event(rdp->nocb_wq, rdp->nocb_head);
>> > +                       wait_event_interruptible(rdp->nocb_wq, rdp->nocb_head);
>> >                 list = ACCESS_ONCE(rdp->nocb_head);
>> >                 if (!list) {
>> >                         schedule_timeout_interruptible(1);
>> > +                       flush_signals(current);
>>
>> Why is that needed?
>
> To satisfy my paranoia.  ;-)  And in case someone ever figures out some
> way to send a signal to a kthread.

Ok. I don't want to cause any insomnia to anyone, so I won't insist ;)
diff mbox

Patch

diff --git a/kernel/rcutree_plugin.h b/kernel/rcutree_plugin.h
index f6e5ec2..43dba2d 100644
--- a/kernel/rcutree_plugin.h
+++ b/kernel/rcutree_plugin.h
@@ -2366,10 +2366,11 @@  static int rcu_nocb_kthread(void *arg)
 	for (;;) {
 		/* If not polling, wait for next batch of callbacks. */
 		if (!rcu_nocb_poll)
-			wait_event(rdp->nocb_wq, rdp->nocb_head);
+			wait_event_interruptible(rdp->nocb_wq, rdp->nocb_head);
 		list = ACCESS_ONCE(rdp->nocb_head);
 		if (!list) {
 			schedule_timeout_interruptible(1);
+			flush_signals(current);
 			continue;
 		}