[Devel] [PATCH RHEL7 COMMIT] ms/writeback: track if we're sleeping on progress in balance_dirty_pages()

Konstantin Khorenko khorenko at virtuozzo.com
Fri Oct 25 13:17:24 MSK 2019


The commit is pushed to "branch-rh7-3.10.0-1062.1.2.vz7.114.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1062.1.2.vz7.114.9
------>
commit 724cd8b5da0c1d38168eb6ba063cdc8e13b912cf
Author: Jens Axboe <axboe at fb.com>
Date:   Fri Oct 25 13:17:23 2019 +0300

    ms/writeback: track if we're sleeping on progress in balance_dirty_pages()
    
    Note in the bdi_writeback structure whenever a task ends up sleeping
    waiting for progress. We can use that information in the lower layers
    to increase the priority of writes.
    
    Signed-off-by: Jens Axboe <axboe at fb.com>
    Reviewed-by: Jan Kara <jack at suse.cz>
    
    https://jira.sw.ru/browse/PSBM-96243
    
    (cherry picked from commit b57d74aff9ab92fbfb7c197c384d1adfa2827b2e)
    Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
    
    Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
    
    =====================
    Patchset description:
    
    block: backport writeback throttling
    
    We have a problem that if we run heavy write load on one cpu
    simultaneousely with short direct reads on other cpu, the latter will
    hang significantly. Writeback throttling looks like a sollution for
    these reads, as it will decrease the priority of long running writeback.
    
    Running simple dd experiment we see that reads latency decreased after
    wbt patches applied:
    https://docs.google.com/spreadsheets/d/1HLtepwFL_N5zm0JcTqMtJoYnf-b6Slwld8DDgL0gNDI
    
    We've ran vconsolidate on custom kernel with these patches, though it
    does not show any performance improvement (likely because this test does
    not produce high rate of writeback), it does not crash or fail the test.
    
    https://jira.sw.ru/browse/PSBM-96243
    
    Jens Axboe (6):
      block: add REQ_BACKGROUND
      writeback: add wbc_to_write_flags()
      writeback: mark background writeback as such
      writeback: track if we're sleeping on progress in
        balance_dirty_pages()
      blk-wbt: add general throttling mechanism
      block: hook up writeback throttling
    
    Omar Sandoval (1):
      block: get rid of struct blk_issue_stat
    
    Pavel Tikhomirov (2):
      x86/asm: remove the unused get_limit() method
      block: enable CONFIG_BLK_WBT*
      blk-wbt: increase maximum queue depth to increase performance of writes
---
 include/linux/backing-dev.h | 3 +++
 mm/backing-dev.c            | 3 ++-
 mm/page-writeback.c         | 2 ++
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index e0c1edf7dd80..dfb80fc7068d 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -55,6 +55,9 @@ struct bdi_writeback {
 	unsigned long last_old_flush;	/* last old data flush */
 
 	struct delayed_work dwork;	/* work item used for writeback */
+
+	unsigned long dirty_sleep;	/* last wait */
+
 	struct list_head b_dirty;	/* dirty inodes */
 	struct list_head b_io;		/* parked for writeback */
 	struct list_head b_more_io;	/* parked for more writeback */
diff --git a/mm/backing-dev.c b/mm/backing-dev.c
index 4efa4ec27a76..395d5615c972 100644
--- a/mm/backing-dev.c
+++ b/mm/backing-dev.c
@@ -439,7 +439,8 @@ static void bdi_wb_init(struct bdi_writeback *wb, struct backing_dev_info *bdi)
 	memset(wb, 0, sizeof(*wb));
 
 	wb->bdi = bdi;
-	wb->last_old_flush = jiffies;
+	wb->dirty_sleep = wb->last_old_flush = jiffies;
+
 	INIT_LIST_HEAD(&wb->b_dirty);
 	INIT_LIST_HEAD(&wb->b_io);
 	INIT_LIST_HEAD(&wb->b_more_io);
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 79e308651819..b542e41fb7ad 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -1518,6 +1518,7 @@ static void balance_dirty_pages(struct address_space *mapping,
 	unsigned long dirty_ratelimit;
 	unsigned long pos_ratio;
 	struct backing_dev_info *bdi = mapping->backing_dev_info;
+	struct bdi_writeback *wb = &bdi->wb;
 	bool strictlimit = bdi->capabilities & BDI_CAP_STRICTLIMIT;
 	unsigned long start_time = jiffies;
 
@@ -1656,6 +1657,7 @@ static void balance_dirty_pages(struct address_space *mapping,
 					  pause,
 					  start_time);
 		__set_current_state(TASK_KILLABLE);
+		wb->dirty_sleep = now;
 		io_schedule_timeout(pause);
 
 		current->dirty_paused_when = now + pause;



More information about the Devel mailing list