aboutsummaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2013-07-12 17:30:07 +0200
committerMoyster <oysterized@gmail.com>2016-09-01 12:07:00 +0200
commit4699c10134e478bd359bea439f6061fc8d9375b3 (patch)
tree764604b39bbc8caaa10f3492bbf4c2a7e78daa7f /fs
parent54405f1d7c45251ca0c6f5a18779d51ba9ae0dd1 (diff)
writeback: Fix occasional slow sync(1)
In case when system contains no dirty pages, wakeup_flusher_threads() will submit WB_SYNC_NONE writeback for 0 pages so wb_writeback() exits immediately without doing anything. Thus sync(1) will write all the dirty inodes from a WB_SYNC_ALL writeback pass which is slow. Fix the problem by using get_nr_dirty_pages() in wakeup_flusher_threads() instead of calculating number of dirty pages manually. That function also takes number of dirty inodes into account. CC: stable@vger.kernel.org Reported-by: Paul Taysom <taysom@chromium.org> Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Cristoforo Cataldo <cristoforo.cataldo@gmail.com> Signed-off-by: flar2 <asegaert@gmail.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/fs-writeback.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index cf94e0b00..5c023a649 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -1079,10 +1079,8 @@ void wakeup_flusher_threads(long nr_pages, enum wb_reason reason)
{
struct backing_dev_info *bdi;
- if (!nr_pages) {
- nr_pages = global_page_state(NR_FILE_DIRTY) +
- global_page_state(NR_UNSTABLE_NFS);
- }
+ if (!nr_pages)
+ nr_pages = get_nr_dirty_pages();
rcu_read_lock();
list_for_each_entry_rcu(bdi, &bdi_list, bdi_list) {