All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org,
	linux-rt-users <linux-rt-users@vger.kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Carsten Emde <C.Emde@osadl.org>, John Kacur <jkacur@redhat.com>,
	stable-rt@vger.kernel.org
Subject: [PATCH RT 4/7] fs: dcache: Use cpu_chill() in trylock loops
Date: Tue, 13 Mar 2012 22:27:02 -0400	[thread overview]
Message-ID: <20120314022945.223176076@goodmis.org> (raw)
In-Reply-To: 20120314022658.783312660@goodmis.org

[-- Attachment #1: 0004-fs-dcache-Use-cpu_chill-in-trylock-loops.patch --]
[-- Type: text/plain, Size: 2160 bytes --]

From: Thomas Gleixner <tglx@linutronix.de>

Retry loops on RT might loop forever when the modifying side was
preempted. Use cpu_chill() instead of cpu_relax() to let the system
make progress.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable-rt@vger.kernel.org
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 fs/autofs4/autofs_i.h |    1 +
 fs/autofs4/expire.c   |    2 +-
 fs/dcache.c           |    7 ++++---
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h
index b620114..83424ab 100644
--- a/fs/autofs4/autofs_i.h
+++ b/fs/autofs4/autofs_i.h
@@ -34,6 +34,7 @@
 #include <linux/sched.h>
 #include <linux/mount.h>
 #include <linux/namei.h>
+#include <linux/delay.h>
 #include <asm/current.h>
 #include <asm/uaccess.h>
 
diff --git a/fs/autofs4/expire.c b/fs/autofs4/expire.c
index d8b6184..f4abda3 100644
--- a/fs/autofs4/expire.c
+++ b/fs/autofs4/expire.c
@@ -170,7 +170,7 @@ again:
 			parent = p->d_parent;
 			if (!seq_spin_trylock(&parent->d_lock)) {
 				seq_spin_unlock(&p->d_lock);
-				cpu_relax();
+				cpu_chill();
 				goto relock;
 			}
 			seq_spin_unlock(&p->d_lock);
diff --git a/fs/dcache.c b/fs/dcache.c
index 10580be..eedf276 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -36,6 +36,7 @@
 #include <linux/bit_spinlock.h>
 #include <linux/rculist_bl.h>
 #include <linux/prefetch.h>
+#include <linux/delay.h>
 #include "internal.h"
 
 /*
@@ -360,7 +361,7 @@ static inline struct dentry *dentry_kill(struct dentry *dentry, int ref)
 	if (inode && !spin_trylock(&inode->i_lock)) {
 relock:
 		seq_spin_unlock(&dentry->d_lock);
-		cpu_relax();
+		cpu_chill();
 		return dentry; /* try again with same dentry */
 	}
 	if (IS_ROOT(dentry))
@@ -738,7 +739,7 @@ relock:
 
 		if (!seq_spin_trylock(&dentry->d_lock)) {
 			spin_unlock(&dcache_lru_lock);
-			cpu_relax();
+			cpu_chill();
 			goto relock;
 		}
 
@@ -2053,7 +2054,7 @@ again:
 	if (dentry->d_count == 1) {
 		if (inode && !spin_trylock(&inode->i_lock)) {
 			seq_spin_unlock(&dentry->d_lock);
-			cpu_relax();
+			cpu_chill();
 			goto again;
 		}
 		dentry->d_flags &= ~DCACHE_CANT_MOUNT;
-- 
1.7.8.3

  parent reply	other threads:[~2012-03-14  2:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-14  2:26 [PATCH RT 0/7] [ANNOUNCE] 3.0.23-rt40-rc1 Steven Rostedt
2012-03-14  2:26 ` [PATCH RT 1/7] Revert "ACPI: Convert embedded controller lock to raw spinlock" Steven Rostedt
2012-03-14  2:27 ` [PATCH RT 2/7] softirq: Check preemption after reenabling interrupts Steven Rostedt
2012-03-14  2:27 ` [PATCH RT 3/7] rt: Introduce cpu_chill() Steven Rostedt
2012-03-14  2:27 ` Steven Rostedt [this message]
2012-03-14  2:27 ` [PATCH RT 5/7] fs: namespace: Use cpu_chill() instead of cpu_relax() Steven Rostedt
2012-03-14  2:27 ` [PATCH RT 6/7] net: " Steven Rostedt
2012-03-14  2:27 ` [PATCH RT 7/7] Linux 3.0.23-rt40-rc1 Steven Rostedt
2012-03-14 12:52 ` [PATCH RT 0/7] [ANNOUNCE] 3.0.23-rt40-rc1 Karsten Wiese
2012-03-14 12:52   ` Karsten Wiese
2012-03-14 15:14   ` Steven Rostedt
2012-03-14 15:14     ` Steven Rostedt

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=20120314022945.223176076@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=C.Emde@osadl.org \
    --cc=jkacur@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=stable-rt@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.