aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/writeback.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2015-05-22 18:23:34 -0400
committerJens Axboe <axboe@fb.com>2015-06-02 10:38:13 -0400
commit2529bb3aadc40a93e642f5f3650f63379a964467 (patch)
treeced5264ace40ca3cbb6899233f7caa1bd79a0903 /include/linux/writeback.h
parent841710aa6e4acd066ab9fe8c8cb6f4e4e6709d83 (diff)
writeback: reset wb_domain->dirty_limit[_tstmp] when memcg domain size changes
The amount of available memory to a memcg wb_domain can change as memcg configuration changes. A domain's ->dirty_limit exists to smooth out sudden drops in dirty threshold; however, when a domain's size actually drops significantly, it hinders the dirty throttling from adjusting to the new configuration leading to unexpected behaviors including unnecessary OOM kills. This patch resolves the issue by adding wb_domain_size_changed() which resets ->dirty_limit[_tstmp] and making memcg call it on configuration 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.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 04a3786c456f..3b73e97ecfc7 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -132,6 +132,26 @@ struct wb_domain {
132 unsigned long dirty_limit; 132 unsigned long dirty_limit;
133}; 133};
134 134
135/**
136 * wb_domain_size_changed - memory available to a wb_domain has changed
137 * @dom: wb_domain of interest
138 *
139 * This function should be called when the amount of memory available to
140 * @dom has changed. It resets @dom's dirty limit parameters to prevent
141 * the past values which don't match the current configuration from skewing
142 * dirty throttling. Without this, when memory size of a wb_domain is
143 * greatly reduced, the dirty throttling logic may allow too many pages to
144 * be dirtied leading to consecutive unnecessary OOMs and may get stuck in
145 * that situation.
146 */
147static inline void wb_domain_size_changed(struct wb_domain *dom)
148{
149 spin_lock(&dom->lock);
150 dom->dirty_limit_tstamp = jiffies;
151 dom->dirty_limit = 0;
152 spin_unlock(&dom->lock);
153}
154
135/* 155/*
136 * fs/fs-writeback.c 156 * fs/fs-writeback.c
137 */ 157 */