From: Lukas Czerner <lczerner@redhat.com>
To: linux-ext4@vger.kernel.org
Cc: Lukas Czerner <lczerner@redhat.com>
Subject: [PATCH 3/3] ext4: Do no use yield() in ext4 code
Date: Fri, 8 Mar 2013 09:23:18 +0100 [thread overview]
Message-ID: <1362730998-3263-3-git-send-email-lczerner@redhat.com> (raw)
In-Reply-To: <1362730998-3263-1-git-send-email-lczerner@redhat.com>
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>
---
fs/ext4/inode.c | 2 +-
fs/ext4/mballoc.c | 8 ++------
2 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 9ea0cde..ab28090 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -1263,7 +1263,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)) {
- yield();
+ cond_resched();
goto repeat;
}
dquot_release_reservation_block(inode, EXT4_C2B(sbi, 1));
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 0a493a1..d2ec0d8 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -3692,11 +3692,7 @@ repeat:
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;
}
@@ -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) {
--
1.7.7.6
next prev parent reply other threads:[~2013-03-08 8:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-08 8:23 [PATCH 1/3] ext4: remove unused variable in ext4_free_blocks() Lukas Czerner
2013-03-08 8:23 ` [PATCH 2/3] ext4: Use kstrtoul() instead of deprecated simple_strtoul() Lukas Czerner
2013-03-11 2:26 ` Theodore Ts'o
2013-03-11 7:36 ` Lukáš Czerner
2013-03-11 15:38 ` Theodore Ts'o
2013-03-08 8:23 ` Lukas Czerner [this message]
2013-03-11 2:41 ` [PATCH 3/3] ext4: Do no use yield() in ext4 code Theodore Ts'o
2013-03-11 2:25 ` [PATCH 1/3] ext4: remove unused variable in ext4_free_blocks() Theodore Ts'o
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=1362730998-3263-3-git-send-email-lczerner@redhat.com \
--to=lczerner@redhat.com \
--cc=linux-ext4@vger.kernel.org \
/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).