From: Wu Fengguang <fengguang.wu@intel.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Jan Kara <jack@suse.cz>, Dave Chinner <david@fromorbit.com>,
Wu Fengguang <fengguang.wu@intel.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: LKML <linux-kernel@vger.kernel.org>
Cc: <linux-fsdevel@vger.kernel.org>
Subject: [PATCH 3/3] writeback: avoid extra sync work at enqueue time
Date: Sun, 01 May 2011 06:36:08 +0800 [thread overview]
Message-ID: <20110430224552.472068133@intel.com> (raw)
In-Reply-To: 20110430223605.034517922@intel.com
[-- Attachment #1: writeback-kill-wb_start.patch --]
[-- Type: text/plain, Size: 2269 bytes --]
This removes writeback_control.wb_start and does more straightforward
sync livelock prevention by setting .older_than_this to prevent extra
inodes from being enqueued in the first place.
CC: Jan Kara <jack@suse.cz>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
---
fs/fs-writeback.c | 17 ++++-------------
include/linux/writeback.h | 3 ---
2 files changed, 4 insertions(+), 16 deletions(-)
--- linux-next.orig/fs/fs-writeback.c 2011-05-01 06:35:19.000000000 +0800
+++ linux-next/fs/fs-writeback.c 2011-05-01 06:35:21.000000000 +0800
@@ -543,15 +543,6 @@ static int writeback_sb_inodes(struct su
continue;
}
- /*
- * Was this inode dirtied after sync_sb_inodes was called?
- * This keeps sync from extra jobs and livelock.
- */
- if (inode_dirtied_after(inode, wbc->wb_start)) {
- spin_unlock(&inode->i_lock);
- return 1;
- }
-
__iget(inode);
pages_skipped = wbc->pages_skipped;
@@ -584,8 +575,6 @@ static void __writeback_inodes_wb(struct
{
int ret = 0;
- if (!wbc->wb_start)
- wbc->wb_start = jiffies; /* livelock avoidance */
while (!list_empty(&wb->b_io)) {
struct inode *inode = wb_inode(wb->b_io.prev);
@@ -682,10 +671,12 @@ static long wb_writeback(struct bdi_writ
* (quickly) tag currently dirty pages
* (maybe slowly) sync all tagged pages
*/
- if (wbc.for_sync)
+ if (wbc.for_sync) {
write_chunk = LONG_MAX;
+ oldest_jif = jiffies;
+ wbc.older_than_this = &oldest_jif;
+ }
- wbc.wb_start = jiffies; /* livelock avoidance */
for (;;) {
/*
* Stop writeback when nr_pages has been consumed
--- linux-next.orig/include/linux/writeback.h 2011-05-01 06:35:17.000000000 +0800
+++ linux-next/include/linux/writeback.h 2011-05-01 06:35:21.000000000 +0800
@@ -26,9 +26,6 @@ struct writeback_control {
enum writeback_sync_modes sync_mode;
unsigned long *older_than_this; /* If !NULL, only write back inodes
older than this */
- unsigned long wb_start; /* Time writeback_inodes_wb was
- called. This is needed to avoid
- extra jobs and livelock */
long nr_to_write; /* Write this many pages, and decrement
this for each page written */
long pages_skipped; /* Pages which were not written */
next prev parent reply other threads:[~2011-04-30 22:48 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-30 22:36 [PATCH 0/3] sync livelock fixes Wu Fengguang
2011-04-30 22:36 ` [PATCH 1/3] writeback: introduce wbc.for_sync to cover the two sync stages Wu Fengguang
2011-05-01 7:46 ` Dave Chinner
2011-05-02 3:23 ` Wu Fengguang
2011-04-30 22:36 ` [PATCH 2/3] writeback: update dirtied_when for synced inode to prevent livelock Wu Fengguang
2011-04-30 22:36 ` Wu Fengguang [this message]
-- strict thread matches above, loose matches on Subject: below --
2011-05-02 3:17 [PATCH 0/3] sync livelock fixes v2 Wu Fengguang
2011-05-02 3:17 ` [PATCH 3/3] writeback: avoid extra sync work at enqueue time Wu Fengguang
2011-05-04 21:24 ` Jan Kara
2011-05-05 12:27 ` Wu Fengguang
2011-05-05 12:41 ` Christoph Hellwig
2011-05-05 12:42 ` Christoph Hellwig
2011-05-05 12:48 ` Wu Fengguang
2011-05-05 14:01 ` Jan Kara
2011-05-05 14:10 ` Wu Fengguang
2011-05-05 14:13 ` Wu Fengguang
2011-05-05 14:34 ` Jan Kara
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=20110430224552.472068133@intel.com \
--to=fengguang.wu@intel.com \
--cc=akpm@linux-foundation.org \
--cc=david@fromorbit.com \
--cc=jack@suse.cz \
/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.