diff options
author | Yafang Shao <laoar.shao@gmail.com> | 2017-11-15 20:33:45 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-11-15 21:21:03 -0500 |
commit | 0f6d24f878568fac579a1962d0bf7cb9f01e0ceb (patch) | |
tree | 5fa7529b42621ab7b1a86ec8d5f3dc01cb9d7b10 | |
parent | 66e8b438bd5c75498cfe915c4219049eaebcb869 (diff) |
mm/page-writeback.c: print a warning if the vm dirtiness settings are illogical
The vm direct limit setting must be set greater than vm background limit
setting. Otherwise print a warning to help the operator to figure out
that the vm dirtiness settings is in illogical state.
Link: http://lkml.kernel.org/r/1506592464-30962-1-git-send-email-laoar.shao@gmail.com
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Michal Hocko <mhocko@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | Documentation/sysctl/vm.txt | 7 | ||||
-rw-r--r-- | mm/page-writeback.c | 5 |
2 files changed, 11 insertions, 1 deletions
diff --git a/Documentation/sysctl/vm.txt b/Documentation/sysctl/vm.txt index 9baf66a9ef4e..30fd16b14196 100644 --- a/Documentation/sysctl/vm.txt +++ b/Documentation/sysctl/vm.txt | |||
@@ -157,6 +157,10 @@ Note: the minimum value allowed for dirty_bytes is two pages (in bytes); any | |||
157 | value lower than this limit will be ignored and the old configuration will be | 157 | value lower than this limit will be ignored and the old configuration will be |
158 | retained. | 158 | retained. |
159 | 159 | ||
160 | Note: the value of dirty_bytes also must be set greater than | ||
161 | dirty_background_bytes or the amount of memory corresponding to | ||
162 | dirty_background_ratio. | ||
163 | |||
160 | ============================================================== | 164 | ============================================================== |
161 | 165 | ||
162 | dirty_expire_centisecs | 166 | dirty_expire_centisecs |
@@ -176,6 +180,9 @@ generating disk writes will itself start writing out dirty data. | |||
176 | 180 | ||
177 | The total available memory is not equal to total system memory. | 181 | The total available memory is not equal to total system memory. |
178 | 182 | ||
183 | Note: dirty_ratio must be set greater than dirty_background_ratio or | ||
184 | ratio corresponding to dirty_background_bytes. | ||
185 | |||
179 | ============================================================== | 186 | ============================================================== |
180 | 187 | ||
181 | dirty_writeback_centisecs | 188 | dirty_writeback_centisecs |
diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 76a43c17761b..768fe4e37e6a 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c | |||
@@ -433,8 +433,11 @@ static void domain_dirty_limits(struct dirty_throttle_control *dtc) | |||
433 | else | 433 | else |
434 | bg_thresh = (bg_ratio * available_memory) / PAGE_SIZE; | 434 | bg_thresh = (bg_ratio * available_memory) / PAGE_SIZE; |
435 | 435 | ||
436 | if (bg_thresh >= thresh) | 436 | if (unlikely(bg_thresh >= thresh)) { |
437 | pr_warn("vm direct limit must be set greater than background limit.\n"); | ||
437 | bg_thresh = thresh / 2; | 438 | bg_thresh = thresh / 2; |
439 | } | ||
440 | |||
438 | tsk = current; | 441 | tsk = current; |
439 | if (tsk->flags & PF_LESS_THROTTLE || rt_task(tsk)) { | 442 | if (tsk->flags & PF_LESS_THROTTLE || rt_task(tsk)) { |
440 | bg_thresh += bg_thresh / 4 + global_wb_domain.dirty_limit / 32; | 443 | bg_thresh += bg_thresh / 4 + global_wb_domain.dirty_limit / 32; |