Skip to content

Commit

Permalink
ext4: do not use yield()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Lukas Czerner authored and Theodore Ts'o committed Mar 11, 2013
1 parent e3d85c3 commit bb8b20e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion fs/ext4/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1352,7 +1352,7 @@ static int ext4_da_reserve_space(struct inode *inode, ext4_lblk_t lblock)
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));
Expand Down
8 changes: 2 additions & 6 deletions fs/ext4/mballoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -3692,11 +3692,7 @@ ext4_mb_discard_group_preallocations(struct super_block *sb,
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;
}

Expand Down Expand Up @@ -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 */
yield();
cond_resched();
ar->len = ar->len >> 1;
}
if (!ar->len) {
Expand Down

0 comments on commit bb8b20e

Please sign in to comment.