From: Jens Axboe <jens.axboe@oracle.com>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: writeback hang in current mainline
Date: Wed, 26 May 2010 14:56:15 +0200 [thread overview]
Message-ID: <20100526125614.GM23411@kernel.dk> (raw)
In-Reply-To: <20100526124549.GA32550@lst.de>
On Wed, May 26 2010, Christoph Hellwig wrote:
> On Wed, May 26, 2010 at 02:21:26PM +0200, Jens Axboe wrote:
> > Ugh ok I see it, I had the caller_frees reverted. Try this :-)
>
> This seems to fix it. Running some more tests now.
Goodie, then the analysis at least is correct. A potentially cleaner fix
would be to just allocate the WB_SYNC_NONE && sb_pinned work struct on
the stack, since then we can get rid of that nastiness in
wb_work_complete() as well (and not pass 'sb_pinned' around so much).
If you have time, care to test this one as well?
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 5c4161f..e9d6182 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -193,8 +193,7 @@ static void bdi_wait_on_work_clear(struct bdi_work *work)
}
static void bdi_alloc_queue_work(struct backing_dev_info *bdi,
- struct wb_writeback_args *args,
- int wait)
+ struct wb_writeback_args *args)
{
struct bdi_work *work;
@@ -206,8 +205,6 @@ static void bdi_alloc_queue_work(struct backing_dev_info *bdi,
if (work) {
bdi_work_init(work, args);
bdi_queue_work(bdi, work);
- if (wait)
- bdi_wait_on_work_clear(work);
} else {
struct bdi_writeback *wb = &bdi->wb;
@@ -216,6 +213,18 @@ static void bdi_alloc_queue_work(struct backing_dev_info *bdi,
}
}
+static void bdi_queue_wait_wb_args(struct backing_dev_info *bdi,
+ struct wb_writeback_args *args)
+{
+ struct bdi_work work;
+
+ bdi_work_init(&work, args);
+ work.state |= WS_ONSTACK;
+
+ bdi_queue_work(bdi, &work);
+ bdi_wait_on_work_clear(&work);
+}
+
/**
* bdi_sync_writeback - start and wait for writeback
* @bdi: the backing device to write from
@@ -240,13 +249,8 @@ static void bdi_sync_writeback(struct backing_dev_info *bdi,
*/
.sb_pinned = 1,
};
- struct bdi_work work;
-
- bdi_work_init(&work, &args);
- work.state |= WS_ONSTACK;
- bdi_queue_work(bdi, &work);
- bdi_wait_on_work_clear(&work);
+ bdi_queue_wait_wb_args(bdi, &args);
}
/**
@@ -282,7 +286,10 @@ void bdi_start_writeback(struct backing_dev_info *bdi, struct super_block *sb,
args.for_background = 1;
}
- bdi_alloc_queue_work(bdi, &args, sb_locked);
+ if (!sb_locked)
+ bdi_alloc_queue_work(bdi, &args);
+ else
+ bdi_queue_wait_wb_args(bdi, &args);
}
/*
@@ -1011,7 +1018,7 @@ static void bdi_writeback_all(struct super_block *sb, long nr_pages)
if (!bdi_has_dirty_io(bdi))
continue;
- bdi_alloc_queue_work(bdi, &args, 0);
+ bdi_alloc_queue_work(bdi, &args);
}
rcu_read_unlock();
--
Jens Axboe
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2010-05-26 12:56 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-26 11:13 writeback hang in current mainline Christoph Hellwig
2010-05-26 11:21 ` Jens Axboe
2010-05-26 11:40 ` Christoph Hellwig
2010-05-26 11:49 ` Jens Axboe
2010-05-26 12:08 ` Christoph Hellwig
2010-05-26 12:21 ` Jens Axboe
2010-05-26 12:45 ` Christoph Hellwig
2010-05-26 12:56 ` Jens Axboe [this message]
2010-05-26 13:42 ` Christoph Hellwig
2010-05-26 13:44 ` Jens Axboe
2010-05-26 13:45 ` Jens Axboe
2010-05-26 13:56 ` Christoph Hellwig
2010-05-26 17:18 ` Jens Axboe
2010-05-26 17:43 ` Christoph Hellwig
2010-05-26 17:47 ` Jens Axboe
2010-05-26 19:18 ` Christoph Hellwig
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=20100526125614.GM23411@kernel.dk \
--to=jens.axboe@oracle.com \
--cc=hch@lst.de \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.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).