]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
fs: dcache: Use cpu_chill() in trylock loops
authorThomas Gleixner <tglx@linutronix.de>
Wed, 7 Mar 2012 20:00:34 +0000 (21:00 +0100)
committerMichal Sojka <sojka@merica.cz>
Sun, 13 Sep 2015 07:47:30 +0000 (09:47 +0200)
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
fs/autofs4/autofs_i.h
fs/autofs4/expire.c
fs/dcache.c
fs/namespace.c

index 8e98cf954babb8944a32fdc58fd3c38760933a5a..7ae1026cdc1797f91ad04e9f3f0f1a9f4a1bdd17 100644 (file)
@@ -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>
 
index 11dd118f75e25e6a8f25f2143724901fb64c72a0..dd34470315fb6f89a5d23ebb7b2d00e91f9dc381 100644 (file)
@@ -150,7 +150,7 @@ again:
                        parent = p->d_parent;
                        if (!spin_trylock(&parent->d_lock)) {
                                spin_unlock(&p->d_lock);
-                               cpu_relax();
+                               cpu_chill();
                                goto relock;
                        }
                        spin_unlock(&p->d_lock);
index b05c557d04220d9dbc975e5d2dbb9df2c70cf2d9..124e97fd9943438edc61b8f162b4a33197046aeb 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/mm.h>
 #include <linux/fs.h>
 #include <linux/fsnotify.h>
+#include <linux/delay.h>
 #include <linux/slab.h>
 #include <linux/init.h>
 #include <linux/hash.h>
@@ -555,7 +556,7 @@ static struct dentry *dentry_kill(struct dentry *dentry)
 
 failed:
        spin_unlock(&dentry->d_lock);
-       cpu_relax();
+       cpu_chill();
        return dentry; /* try again with same dentry */
 }
 
@@ -2361,7 +2362,7 @@ again:
        if (dentry->d_lockref.count == 1) {
                if (!spin_trylock(&inode->i_lock)) {
                        spin_unlock(&dentry->d_lock);
-                       cpu_relax();
+                       cpu_chill();
                        goto again;
                }
                dentry->d_flags &= ~DCACHE_CANT_MOUNT;
index 02b2deacfaac138d297022f2e0a0c534ae79f2bc..32fcf4aeb03daff6d074ca0ff9d989f801eb6216 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/mnt_namespace.h>
 #include <linux/user_namespace.h>
 #include <linux/namei.h>
+#include <linux/delay.h>
 #include <linux/security.h>
 #include <linux/idr.h>
 #include <linux/init.h>                /* init_rootfs */
@@ -355,7 +356,7 @@ int __mnt_want_write(struct vfsmount *m)
        smp_mb();
        while (ACCESS_ONCE(mnt->mnt.mnt_flags) & MNT_WRITE_HOLD) {
                preempt_enable();
-               cpu_relax();
+               cpu_chill();
                preempt_disable();
        }
        /*