All of lore.kernel.org
 help / color / mirror / Atom feed
From: Josef Bacik <jbacik@fusionio.com>
To: <linux-btrfs@vger.kernel.org>
Cc: <walken@google.com>, <linux-kernel@vger.kernel.org>,
	<mingo@elte.hu>, <peter@hurleysoftware.com>,
	<akpm@linux-foundation.org>
Subject: [PATCH 2/2] Btrfs: stop caching thread if extetn_commit_sem is contended
Date: Thu, 19 Sep 2013 11:48:08 -0400	[thread overview]
Message-ID: <1379605688-987-2-git-send-email-jbacik@fusionio.com> (raw)
In-Reply-To: <1379605688-987-1-git-send-email-jbacik@fusionio.com>

We can starve out the transaction commit with a bunch of caching threads all
running at the same time.  This is because we will only drop the
extent_commit_sem if we need_resched(), which isn't likely to happen since we
will be reading a lot from the disk so have already schedule()'ed plenty.  Alex
observed that he could starve out a transaction commit for up to a minute with
32 caching threads all running at once.  This will allow us to drop the
extent_commit_sem to allow the transaction commit to swap the commit_root out
and then all the cachers will start back up.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
---
 fs/btrfs/extent-tree.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index cfb3cf7..cc074c34 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -442,7 +442,8 @@ next:
 			if (ret)
 				break;
 
-			if (need_resched()) {
+			if (need_resched() ||
+			    rwsem_is_contended(&fs_info->extent_commit_sem)) {
 				caching_ctl->progress = last;
 				btrfs_release_path(path);
 				up_read(&fs_info->extent_commit_sem);
-- 
1.8.3.1


  reply	other threads:[~2013-09-19 15:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-19 15:48 [PATCH 1/2] rwsem: add rwsem_is_contended V2 Josef Bacik
2013-09-19 15:48 ` Josef Bacik [this message]
2013-09-20  5:12   ` [PATCH 2/2] Btrfs: stop caching thread if extetn_commit_sem is contended Ingo Molnar
2013-09-26 12:40     ` Josef Bacik
2013-09-26 12:43       ` Ingo Molnar
2013-09-19 22:57 ` [PATCH 1/2] rwsem: add rwsem_is_contended V2 Peter Hurley
2013-09-19 23:27   ` Josef Bacik

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=1379605688-987-2-git-send-email-jbacik@fusionio.com \
    --to=jbacik@fusionio.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peter@hurleysoftware.com \
    --cc=walken@google.com \
    /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.