diff for duplicates of <20171006082020.GA12192@infradead.org> diff --git a/a/1.txt b/N1/1.txt index fc8e473..bfe63a6 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -21,171 +21,3 @@ should pick it up, so we wouldn't need the manual change. Untested patch for that below: --- ->From 77881bd72b5fb1219fc74625b0380930f9c580df Mon Sep 17 00:00:00 2001 -From: Christoph Hellwig <hch@lst.de> -Date: Fri, 6 Oct 2017 10:18:53 +0200 -Subject: mm: move all laptop_mode handling to backing-dev.c - -It isn't block-device specific and oddly spread over multiple files -at the moment: - -TODO: audit that the unregistration changes are fine - -Signed-off-by: Christoph Hellwig <hch@lst.de> ---- - block/blk-core.c | 3 --- - include/linux/writeback.h | 6 ------ - mm/backing-dev.c | 36 ++++++++++++++++++++++++++++++++++++ - mm/page-writeback.c | 36 ------------------------------------ - 4 files changed, 36 insertions(+), 45 deletions(-) - -diff --git a/block/blk-core.c b/block/blk-core.c -index 14f7674fa0b1..f5f916b28c40 100644 ---- a/block/blk-core.c -+++ b/block/blk-core.c -@@ -662,7 +662,6 @@ void blk_cleanup_queue(struct request_queue *q) - blk_flush_integrity(); - - /* @q won't process any more request, flush async actions */ -- del_timer_sync(&q->backing_dev_info->laptop_mode_wb_timer); - blk_sync_queue(q); - - if (q->mq_ops) -@@ -841,8 +840,6 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id) - q->backing_dev_info->name = "block"; - q->node = node_id; - -- setup_timer(&q->backing_dev_info->laptop_mode_wb_timer, -- laptop_mode_timer_fn, (unsigned long) q); - setup_timer(&q->timeout, blk_rq_timed_out_timer, (unsigned long) q); - INIT_LIST_HEAD(&q->queue_head); - INIT_LIST_HEAD(&q->timeout_list); -diff --git a/include/linux/writeback.h b/include/linux/writeback.h -index 9c0091678af4..e6ba35a5e1f7 100644 ---- a/include/linux/writeback.h -+++ b/include/linux/writeback.h -@@ -327,14 +327,8 @@ static inline void cgroup_writeback_umount(void) - /* - * mm/page-writeback.c - */ --#ifdef CONFIG_BLOCK - void laptop_io_completion(struct backing_dev_info *info); - void laptop_sync_completion(void); --void laptop_mode_sync(struct work_struct *work); --void laptop_mode_timer_fn(unsigned long data); --#else --static inline void laptop_sync_completion(void) { } --#endif - bool node_dirty_ok(struct pglist_data *pgdat); - int wb_domain_init(struct wb_domain *dom, gfp_t gfp); - #ifdef CONFIG_CGROUP_WRITEBACK -diff --git a/mm/backing-dev.c b/mm/backing-dev.c -index e19606bb41a0..cb36f07f2af2 100644 ---- a/mm/backing-dev.c -+++ b/mm/backing-dev.c -@@ -822,6 +822,38 @@ static void cgwb_remove_from_bdi_list(struct bdi_writeback *wb) - - #endif /* CONFIG_CGROUP_WRITEBACK */ - -+static void laptop_mode_timer_fn(unsigned long data) -+{ -+ struct backing_dev_info *bdi = (struct backing_dev_info *)data; -+ -+ wakeup_flusher_threads_bdi(bdi, WB_REASON_LAPTOP_TIMER); -+} -+ -+/* -+ * We've spun up the disk and we're in laptop mode: schedule writeback -+ * of all dirty data a few seconds from now. If the flush is already scheduled -+ * then push it back - the user is still using the disk. -+ */ -+void laptop_io_completion(struct backing_dev_info *bdi) -+{ -+ mod_timer(&bdi->laptop_mode_wb_timer, jiffies + laptop_mode); -+} -+ -+/* -+ * We're in laptop mode and we've just synced. The sync's writes will have -+ * caused another writeback to be scheduled by laptop_io_completion. -+ * Nothing needs to be written back anymore, so we unschedule the writeback. -+ */ -+void laptop_sync_completion(void) -+{ -+ struct backing_dev_info *bdi; -+ -+ rcu_read_lock(); -+ list_for_each_entry_rcu(bdi, &bdi_list, bdi_list) -+ del_timer(&bdi->laptop_mode_wb_timer); -+ rcu_read_unlock(); -+} -+ - static int bdi_init(struct backing_dev_info *bdi) - { - int ret; -@@ -835,6 +867,8 @@ static int bdi_init(struct backing_dev_info *bdi) - INIT_LIST_HEAD(&bdi->bdi_list); - INIT_LIST_HEAD(&bdi->wb_list); - init_waitqueue_head(&bdi->wb_waitq); -+ setup_timer(&bdi->laptop_mode_wb_timer, -+ laptop_mode_timer_fn, (unsigned long)bdi); - - ret = cgwb_bdi_init(bdi); - -@@ -916,6 +950,8 @@ EXPORT_SYMBOL(bdi_register_owner); - */ - static void bdi_remove_from_list(struct backing_dev_info *bdi) - { -+ del_timer_sync(&bdi->laptop_mode_wb_timer); -+ - spin_lock_bh(&bdi_lock); - list_del_rcu(&bdi->bdi_list); - spin_unlock_bh(&bdi_lock); -diff --git a/mm/page-writeback.c b/mm/page-writeback.c -index 8d1fc593bce8..f8fe90dc529d 100644 ---- a/mm/page-writeback.c -+++ b/mm/page-writeback.c -@@ -1976,42 +1976,6 @@ int dirty_writeback_centisecs_handler(struct ctl_table *table, int write, - return 0; - } - --#ifdef CONFIG_BLOCK --void laptop_mode_timer_fn(unsigned long data) --{ -- struct request_queue *q = (struct request_queue *)data; -- -- wakeup_flusher_threads_bdi(q->backing_dev_info, WB_REASON_LAPTOP_TIMER); --} -- --/* -- * We've spun up the disk and we're in laptop mode: schedule writeback -- * of all dirty data a few seconds from now. If the flush is already scheduled -- * then push it back - the user is still using the disk. -- */ --void laptop_io_completion(struct backing_dev_info *info) --{ -- mod_timer(&info->laptop_mode_wb_timer, jiffies + laptop_mode); --} -- --/* -- * We're in laptop mode and we've just synced. The sync's writes will have -- * caused another writeback to be scheduled by laptop_io_completion. -- * Nothing needs to be written back anymore, so we unschedule the writeback. -- */ --void laptop_sync_completion(void) --{ -- struct backing_dev_info *bdi; -- -- rcu_read_lock(); -- -- list_for_each_entry_rcu(bdi, &bdi_list, bdi_list) -- del_timer(&bdi->laptop_mode_wb_timer); -- -- rcu_read_unlock(); --} --#endif -- - /* - * If ratelimit_pages is too high then we can get into dirty-data overload - * if a large number of processes all perform writes at the same time. --- -2.14.1 diff --git a/a/content_digest b/N1/content_digest index cb9740c..723b7d3 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -40,174 +40,6 @@ "\n" "Untested patch for that below:\n" "\n" - "---\n" - ">From 77881bd72b5fb1219fc74625b0380930f9c580df Mon Sep 17 00:00:00 2001\n" - "From: Christoph Hellwig <hch@lst.de>\n" - "Date: Fri, 6 Oct 2017 10:18:53 +0200\n" - "Subject: mm: move all laptop_mode handling to backing-dev.c\n" - "\n" - "It isn't block-device specific and oddly spread over multiple files\n" - "at the moment:\n" - "\n" - "TODO: audit that the unregistration changes are fine\n" - "\n" - "Signed-off-by: Christoph Hellwig <hch@lst.de>\n" - "---\n" - " block/blk-core.c | 3 ---\n" - " include/linux/writeback.h | 6 ------\n" - " mm/backing-dev.c | 36 ++++++++++++++++++++++++++++++++++++\n" - " mm/page-writeback.c | 36 ------------------------------------\n" - " 4 files changed, 36 insertions(+), 45 deletions(-)\n" - "\n" - "diff --git a/block/blk-core.c b/block/blk-core.c\n" - "index 14f7674fa0b1..f5f916b28c40 100644\n" - "--- a/block/blk-core.c\n" - "+++ b/block/blk-core.c\n" - "@@ -662,7 +662,6 @@ void blk_cleanup_queue(struct request_queue *q)\n" - " \tblk_flush_integrity();\n" - " \n" - " \t/* @q won't process any more request, flush async actions */\n" - "-\tdel_timer_sync(&q->backing_dev_info->laptop_mode_wb_timer);\n" - " \tblk_sync_queue(q);\n" - " \n" - " \tif (q->mq_ops)\n" - "@@ -841,8 +840,6 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id)\n" - " \tq->backing_dev_info->name = \"block\";\n" - " \tq->node = node_id;\n" - " \n" - "-\tsetup_timer(&q->backing_dev_info->laptop_mode_wb_timer,\n" - "-\t\t laptop_mode_timer_fn, (unsigned long) q);\n" - " \tsetup_timer(&q->timeout, blk_rq_timed_out_timer, (unsigned long) q);\n" - " \tINIT_LIST_HEAD(&q->queue_head);\n" - " \tINIT_LIST_HEAD(&q->timeout_list);\n" - "diff --git a/include/linux/writeback.h b/include/linux/writeback.h\n" - "index 9c0091678af4..e6ba35a5e1f7 100644\n" - "--- a/include/linux/writeback.h\n" - "+++ b/include/linux/writeback.h\n" - "@@ -327,14 +327,8 @@ static inline void cgroup_writeback_umount(void)\n" - " /*\n" - " * mm/page-writeback.c\n" - " */\n" - "-#ifdef CONFIG_BLOCK\n" - " void laptop_io_completion(struct backing_dev_info *info);\n" - " void laptop_sync_completion(void);\n" - "-void laptop_mode_sync(struct work_struct *work);\n" - "-void laptop_mode_timer_fn(unsigned long data);\n" - "-#else\n" - "-static inline void laptop_sync_completion(void) { }\n" - "-#endif\n" - " bool node_dirty_ok(struct pglist_data *pgdat);\n" - " int wb_domain_init(struct wb_domain *dom, gfp_t gfp);\n" - " #ifdef CONFIG_CGROUP_WRITEBACK\n" - "diff --git a/mm/backing-dev.c b/mm/backing-dev.c\n" - "index e19606bb41a0..cb36f07f2af2 100644\n" - "--- a/mm/backing-dev.c\n" - "+++ b/mm/backing-dev.c\n" - "@@ -822,6 +822,38 @@ static void cgwb_remove_from_bdi_list(struct bdi_writeback *wb)\n" - " \n" - " #endif\t/* CONFIG_CGROUP_WRITEBACK */\n" - " \n" - "+static void laptop_mode_timer_fn(unsigned long data)\n" - "+{\n" - "+\tstruct backing_dev_info *bdi = (struct backing_dev_info *)data;\n" - "+\n" - "+\twakeup_flusher_threads_bdi(bdi, WB_REASON_LAPTOP_TIMER);\n" - "+}\n" - "+\n" - "+/*\n" - "+ * We've spun up the disk and we're in laptop mode: schedule writeback\n" - "+ * of all dirty data a few seconds from now. If the flush is already scheduled\n" - "+ * then push it back - the user is still using the disk.\n" - "+ */\n" - "+void laptop_io_completion(struct backing_dev_info *bdi)\n" - "+{\n" - "+\tmod_timer(&bdi->laptop_mode_wb_timer, jiffies + laptop_mode);\n" - "+}\n" - "+\n" - "+/*\n" - "+ * We're in laptop mode and we've just synced. The sync's writes will have\n" - "+ * caused another writeback to be scheduled by laptop_io_completion.\n" - "+ * Nothing needs to be written back anymore, so we unschedule the writeback.\n" - "+ */\n" - "+void laptop_sync_completion(void)\n" - "+{\n" - "+\tstruct backing_dev_info *bdi;\n" - "+\n" - "+\trcu_read_lock();\n" - "+\tlist_for_each_entry_rcu(bdi, &bdi_list, bdi_list)\n" - "+\t\tdel_timer(&bdi->laptop_mode_wb_timer);\n" - "+\trcu_read_unlock();\n" - "+}\n" - "+\n" - " static int bdi_init(struct backing_dev_info *bdi)\n" - " {\n" - " \tint ret;\n" - "@@ -835,6 +867,8 @@ static int bdi_init(struct backing_dev_info *bdi)\n" - " \tINIT_LIST_HEAD(&bdi->bdi_list);\n" - " \tINIT_LIST_HEAD(&bdi->wb_list);\n" - " \tinit_waitqueue_head(&bdi->wb_waitq);\n" - "+\tsetup_timer(&bdi->laptop_mode_wb_timer,\n" - "+\t\t laptop_mode_timer_fn, (unsigned long)bdi);\n" - " \n" - " \tret = cgwb_bdi_init(bdi);\n" - " \n" - "@@ -916,6 +950,8 @@ EXPORT_SYMBOL(bdi_register_owner);\n" - " */\n" - " static void bdi_remove_from_list(struct backing_dev_info *bdi)\n" - " {\n" - "+\tdel_timer_sync(&bdi->laptop_mode_wb_timer);\n" - "+\n" - " \tspin_lock_bh(&bdi_lock);\n" - " \tlist_del_rcu(&bdi->bdi_list);\n" - " \tspin_unlock_bh(&bdi_lock);\n" - "diff --git a/mm/page-writeback.c b/mm/page-writeback.c\n" - "index 8d1fc593bce8..f8fe90dc529d 100644\n" - "--- a/mm/page-writeback.c\n" - "+++ b/mm/page-writeback.c\n" - "@@ -1976,42 +1976,6 @@ int dirty_writeback_centisecs_handler(struct ctl_table *table, int write,\n" - " \treturn 0;\n" - " }\n" - " \n" - "-#ifdef CONFIG_BLOCK\n" - "-void laptop_mode_timer_fn(unsigned long data)\n" - "-{\n" - "-\tstruct request_queue *q = (struct request_queue *)data;\n" - "-\n" - "-\twakeup_flusher_threads_bdi(q->backing_dev_info, WB_REASON_LAPTOP_TIMER);\n" - "-}\n" - "-\n" - "-/*\n" - "- * We've spun up the disk and we're in laptop mode: schedule writeback\n" - "- * of all dirty data a few seconds from now. If the flush is already scheduled\n" - "- * then push it back - the user is still using the disk.\n" - "- */\n" - "-void laptop_io_completion(struct backing_dev_info *info)\n" - "-{\n" - "-\tmod_timer(&info->laptop_mode_wb_timer, jiffies + laptop_mode);\n" - "-}\n" - "-\n" - "-/*\n" - "- * We're in laptop mode and we've just synced. The sync's writes will have\n" - "- * caused another writeback to be scheduled by laptop_io_completion.\n" - "- * Nothing needs to be written back anymore, so we unschedule the writeback.\n" - "- */\n" - "-void laptop_sync_completion(void)\n" - "-{\n" - "-\tstruct backing_dev_info *bdi;\n" - "-\n" - "-\trcu_read_lock();\n" - "-\n" - "-\tlist_for_each_entry_rcu(bdi, &bdi_list, bdi_list)\n" - "-\t\tdel_timer(&bdi->laptop_mode_wb_timer);\n" - "-\n" - "-\trcu_read_unlock();\n" - "-}\n" - "-#endif\n" - "-\n" - " /*\n" - " * If ratelimit_pages is too high then we can get into dirty-data overload\n" - " * if a large number of processes all perform writes at the same time.\n" - "-- \n" - 2.14.1 + --- -e2b603b85feb157469692df84e364dd73f489bca14c6ccfb8426b602a2b6ec19 +39d60cba225b97145aaba2a02e72ef478be01894634cba6ab85f6d56ba37ca78
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.