summaryrefslogtreecommitdiffstats
path: root/include/linux/writeback.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2015-05-22 18:23:21 -0400
committerJens Axboe <axboe@fb.com>2015-06-02 10:38:12 -0400
commit380c27ca33ebecc9da35aa90c8b3a9154f90aac2 (patch)
tree9216a1f6382db31f61bc7ccf3983d0b83553dbe8 /include/linux/writeback.h
parent8a73179956e649df0d4b3250db17734f272d8266 (diff)
writeback: implement wb_domain
Dirtyable memory is distributed to a wb (bdi_writeback) according to the relative bandwidth the wb is writing out in the whole system. This distribution is global - each wb is measured against all other wb's and gets the proportinately sized portion of the memory in the whole system. For cgroup writeback, the amount of dirtyable memory is scoped by memcg and thus each wb would need to be measured and controlled in its memcg. IOW, a wb will belong to two writeback domains - the global and memcg domains. Currently, what constitutes the global writeback domain are scattered across a number of global states. This patch starts collecting them into struct wb_domain. * fprop_global which serves as the basis for proportional bandwidth measurement and its period timer are moved into struct wb_domain. * global_wb_domain hosts the states for the global domain. * While at it, flatten wb_writeout_fraction() into its callers. This thin wrapper doesn't provide any actual benefits while getting in the way. This is pure reorganization and doesn't introduce any behavioral changes. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Jens Axboe <axboe@kernel.dk> Cc: Jan Kara <jack@suse.cz> Cc: Wu Fengguang <fengguang.wu@intel.com> Cc: Greg Thelen <gthelen@google.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'include/linux/writeback.h')
-rw-r--r--include/linux/writeback.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 80adf3d88d9d..3148db1296a2 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -7,6 +7,7 @@
7#include <linux/sched.h> 7#include <linux/sched.h>
8#include <linux/workqueue.h> 8#include <linux/workqueue.h>
9#include <linux/fs.h> 9#include <linux/fs.h>
10#include <linux/flex_proportions.h>
10 11
11DECLARE_PER_CPU(int, dirty_throttle_leaks); 12DECLARE_PER_CPU(int, dirty_throttle_leaks);
12 13
@@ -87,6 +88,36 @@ struct writeback_control {
87}; 88};
88 89
89/* 90/*
91 * A wb_domain represents a domain that wb's (bdi_writeback's) belong to
92 * and are measured against each other in. There always is one global
93 * domain, global_wb_domain, that every wb in the system is a member of.
94 * This allows measuring the relative bandwidth of each wb to distribute
95 * dirtyable memory accordingly.
96 */
97struct wb_domain {
98 /*
99 * Scale the writeback cache size proportional to the relative
100 * writeout speed.
101 *
102 * We do this by keeping a floating proportion between BDIs, based
103 * on page writeback completions [end_page_writeback()]. Those
104 * devices that write out pages fastest will get the larger share,
105 * while the slower will get a smaller share.
106 *
107 * We use page writeout completions because we are interested in
108 * getting rid of dirty pages. Having them written out is the
109 * primary goal.
110 *
111 * We introduce a concept of time, a period over which we measure
112 * these events, because demand can/will vary over time. The length
113 * of this period itself is measured in page writeback completions.
114 */
115 struct fprop_global completions;
116 struct timer_list period_timer; /* timer for aging of completions */
117 unsigned long period_time;
118};
119
120/*
90 * fs/fs-writeback.c 121 * fs/fs-writeback.c
91 */ 122 */
92struct bdi_writeback; 123struct bdi_writeback;
@@ -120,6 +151,7 @@ static inline void laptop_sync_completion(void) { }
120#endif 151#endif
121void throttle_vm_writeout(gfp_t gfp_mask); 152void throttle_vm_writeout(gfp_t gfp_mask);
122bool zone_dirty_ok(struct zone *zone); 153bool zone_dirty_ok(struct zone *zone);
154int wb_domain_init(struct wb_domain *dom, gfp_t gfp);
123 155
124extern unsigned long global_dirty_limit; 156extern unsigned long global_dirty_limit;
125 157