]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ext4: do not use yield()
authorLukas Czerner <lczerner@redhat.com>
Mon, 11 Mar 2013 02:28:09 +0000 (22:28 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 11 Mar 2013 02:28:09 +0000 (22:28 -0400)
Using yield() is strongly discouraged (see sched/core.c) especially
since we can just use cond_resched().

Replace all use of yield() with cond_resched().

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
fs/ext4/inode.c
fs/ext4/mballoc.c

index 117a9e7aa4a0f2047842e4d3bfac446b02d5dd88..48fc023ab0a249660ca87409b1446bde2c436edd 100644 (file)
@@ -1352,7 +1352,7 @@ repeat:
                ei->i_da_metadata_calc_last_lblock = save_last_lblock;
                spin_unlock(&ei->i_block_reservation_lock);
                if (ext4_should_retry_alloc(inode->i_sb, &retries)) {
                ei->i_da_metadata_calc_last_lblock = save_last_lblock;
                spin_unlock(&ei->i_block_reservation_lock);
                if (ext4_should_retry_alloc(inode->i_sb, &retries)) {
-                       yield();
+                       cond_resched();
                        goto repeat;
                }
                dquot_release_reservation_block(inode, EXT4_C2B(sbi, 1));
                        goto repeat;
                }
                dquot_release_reservation_block(inode, EXT4_C2B(sbi, 1));
index 75e05f3a730f970b326b55d4a7936c5067ae16d3..8b2ea9f75004e1b35da68266e3ea1350a65015e7 100644 (file)
@@ -3692,11 +3692,7 @@ repeat:
        if (free < needed && busy) {
                busy = 0;
                ext4_unlock_group(sb, group);
        if (free < needed && busy) {
                busy = 0;
                ext4_unlock_group(sb, group);
-               /*
-                * Yield the CPU here so that we don't get soft lockup
-                * in non preempt case.
-                */
-               yield();
+               cond_resched();
                goto repeat;
        }
 
                goto repeat;
        }
 
@@ -4246,7 +4242,7 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle,
                        ext4_claim_free_clusters(sbi, ar->len, ar->flags)) {
 
                        /* let others to free the space */
                        ext4_claim_free_clusters(sbi, ar->len, ar->flags)) {
 
                        /* let others to free the space */
-                       yield();
+                       cond_resched();
                        ar->len = ar->len >> 1;
                }
                if (!ar->len) {
                        ar->len = ar->len >> 1;
                }
                if (!ar->len) {