linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Chen <david.chen@nutanix.com>
To: linux-kernel@vger.kernel.org
Cc: Chunwei Chen <david.chen@nutanix.com>,
	"Paul E . McKenney" <paulmck@linux.vnet.ibm.com>
Subject: [PATCH] rcu: Fix NOCB follower not waking up causing OOM
Date: Mon, 30 Jul 2018 15:23:42 -0700	[thread overview]
Message-ID: <1532989422-1517-1-git-send-email-david.chen@nutanix.com> (raw)
In-Reply-To: <20180730193245.GA24813@linux.vnet.ibm.com>

From: Chunwei Chen <david.chen@nutanix.com>

In 4.9 stable branch, we hit an issue where one of the NOCB follower
thread wasn't waking up, even though the follower list is not empty.
The follower list just kept on growing and never got reclaimed, and
finally caused the system to run out of memory.

This issue is similar to the issue fixed by 6b5fc3a13318, both are
caused by lacking proper memory barrier before swake_up, and causing
wake up to be missed. While we do have smp_mb__after_atomic here, but
smp_mb__after_atomic is only a compiler barrier on x86, so it doesn't
prevent this at all. So we fix this issue by changing it to smp_mb.

Note, this patch doesn't apply to master, because in master the follower
list is changed to spinlock protected list. So there's no such issue
there.

Signed-off-by: Chunwei Chen <david.chen@nutanix.com>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 kernel/rcu/tree_plugin.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index 554ea54..b2d663d 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -2090,7 +2090,7 @@ static void nocb_leader_wait(struct rcu_data *my_rdp)
 		/* Append callbacks to follower's "done" list. */
 		tail = xchg(&rdp->nocb_follower_tail, rdp->nocb_gp_tail);
 		*tail = rdp->nocb_gp_head;
-		smp_mb__after_atomic(); /* Store *tail before wakeup. */
+		smp_mb(); /* Store *tail before wakeup. */
 		if (rdp != my_rdp && tail == &rdp->nocb_follower_head) {
 			/*
 			 * List was empty, wake up the follower.
-- 
1.9.4


      reply	other threads:[~2018-07-30 22:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-20 23:05 RCU nocb list not reclaiming causing OOM David Chen
2018-07-20 23:32 ` Paul E. McKenney
     [not found]   ` <BYAPR02MB450146DF9F67788ED1F0801D94500@BYAPR02MB4501.namprd02.prod.outlook.com>
2018-07-27 19:07     ` David Chen
2018-07-27 22:31       ` Paul E. McKenney
2018-07-27 23:16         ` David Chen
2018-07-27 23:47           ` Paul E. McKenney
2018-07-28  0:07             ` David Chen
2018-07-28  1:47               ` Paul E. McKenney
2018-07-28  8:29                 ` Paul E. McKenney
2018-07-30 19:08                   ` David Chen
2018-07-30 19:32                     ` Paul E. McKenney
2018-07-30 22:23                       ` David Chen [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=1532989422-1517-1-git-send-email-david.chen@nutanix.com \
    --to=david.chen@nutanix.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@linux.vnet.ibm.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).