diff options
author | David Rientjes <rientjes@google.com> | 2009-01-06 17:39:31 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-06 18:59:03 -0500 |
commit | 2da02997e08d3efe8174c7a47696e6f7cbe69ba9 (patch) | |
tree | 2e52d9346c52dda83dc8cc9626cbe302e026ad9a /Documentation | |
parent | 364aeb2849789b51bf4b9af2ddd02fee7285c54e (diff) |
mm: add dirty_background_bytes and dirty_bytes sysctls
This change introduces two new sysctls to /proc/sys/vm:
dirty_background_bytes and dirty_bytes.
dirty_background_bytes is the counterpart to dirty_background_ratio and
dirty_bytes is the counterpart to dirty_ratio.
With growing memory capacities of individual machines, it's no longer
sufficient to specify dirty thresholds as a percentage of the amount of
dirtyable memory over the entire system.
dirty_background_bytes and dirty_bytes specify quantities of memory, in
bytes, that represent the dirty limits for the entire system. If either
of these values is set, its value represents the amount of dirty memory
that is needed to commence either background or direct writeback.
When a `bytes' or `ratio' file is written, its counterpart becomes a
function of the written value. For example, if dirty_bytes is written to
be 8096, 8K of memory is required to commence direct writeback.
dirty_ratio is then functionally equivalent to 8K / the amount of
dirtyable memory:
dirtyable_memory = free pages + mapped pages + file cache
dirty_background_bytes = dirty_background_ratio * dirtyable_memory
-or-
dirty_background_ratio = dirty_background_bytes / dirtyable_memory
AND
dirty_bytes = dirty_ratio * dirtyable_memory
-or-
dirty_ratio = dirty_bytes / dirtyable_memory
Only one of dirty_background_bytes and dirty_background_ratio may be
specified at a time, and only one of dirty_bytes and dirty_ratio may be
specified. When one sysctl is written, the other appears as 0 when read.
The `bytes' files operate on a page size granularity since dirty limits
are compared with ZVC values, which are in page units.
Prior to this change, the minimum dirty_ratio was 5 as implemented by
get_dirty_limits() although /proc/sys/vm/dirty_ratio would show any user
written value between 0 and 100. This restriction is maintained, but
dirty_bytes has a lower limit of only one page.
Also prior to this change, the dirty_background_ratio could not equal or
exceed dirty_ratio. This restriction is maintained in addition to
restricting dirty_background_bytes. If either background threshold equals
or exceeds that of the dirty threshold, it is implicitly set to half the
dirty threshold.
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Christoph Lameter <cl@linux-foundation.org>
Signed-off-by: David Rientjes <rientjes@google.com>
Cc: Andrea Righi <righi.andrea@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/filesystems/proc.txt | 26 | ||||
-rw-r--r-- | Documentation/sysctl/vm.txt | 3 |
2 files changed, 27 insertions, 2 deletions
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt index 71df353e367c..32e94635484f 100644 --- a/Documentation/filesystems/proc.txt +++ b/Documentation/filesystems/proc.txt | |||
@@ -1385,6 +1385,15 @@ swapcache reclaim. Decreasing vfs_cache_pressure causes the kernel to prefer | |||
1385 | to retain dentry and inode caches. Increasing vfs_cache_pressure beyond 100 | 1385 | to retain dentry and inode caches. Increasing vfs_cache_pressure beyond 100 |
1386 | causes the kernel to prefer to reclaim dentries and inodes. | 1386 | causes the kernel to prefer to reclaim dentries and inodes. |
1387 | 1387 | ||
1388 | dirty_background_bytes | ||
1389 | ---------------------- | ||
1390 | |||
1391 | Contains the amount of dirty memory at which the pdflush background writeback | ||
1392 | daemon will start writeback. | ||
1393 | |||
1394 | If dirty_background_bytes is written, dirty_background_ratio becomes a function | ||
1395 | of its value (dirty_background_bytes / the amount of dirtyable system memory). | ||
1396 | |||
1388 | dirty_background_ratio | 1397 | dirty_background_ratio |
1389 | ---------------------- | 1398 | ---------------------- |
1390 | 1399 | ||
@@ -1393,14 +1402,29 @@ pages + file cache, not including locked pages and HugePages), the number of | |||
1393 | pages at which the pdflush background writeback daemon will start writing out | 1402 | pages at which the pdflush background writeback daemon will start writing out |
1394 | dirty data. | 1403 | dirty data. |
1395 | 1404 | ||
1405 | If dirty_background_ratio is written, dirty_background_bytes becomes a function | ||
1406 | of its value (dirty_background_ratio * the amount of dirtyable system memory). | ||
1407 | |||
1408 | dirty_bytes | ||
1409 | ----------- | ||
1410 | |||
1411 | Contains the amount of dirty memory at which a process generating disk writes | ||
1412 | will itself start writeback. | ||
1413 | |||
1414 | If dirty_bytes is written, dirty_ratio becomes a function of its value | ||
1415 | (dirty_bytes / the amount of dirtyable system memory). | ||
1416 | |||
1396 | dirty_ratio | 1417 | dirty_ratio |
1397 | ----------------- | 1418 | ----------- |
1398 | 1419 | ||
1399 | Contains, as a percentage of the dirtyable system memory (free pages + mapped | 1420 | Contains, as a percentage of the dirtyable system memory (free pages + mapped |
1400 | pages + file cache, not including locked pages and HugePages), the number of | 1421 | pages + file cache, not including locked pages and HugePages), the number of |
1401 | pages at which a process which is generating disk writes will itself start | 1422 | pages at which a process which is generating disk writes will itself start |
1402 | writing out dirty data. | 1423 | writing out dirty data. |
1403 | 1424 | ||
1425 | If dirty_ratio is written, dirty_bytes becomes a function of its value | ||
1426 | (dirty_ratio * the amount of dirtyable system memory). | ||
1427 | |||
1404 | dirty_writeback_centisecs | 1428 | dirty_writeback_centisecs |
1405 | ------------------------- | 1429 | ------------------------- |
1406 | 1430 | ||
diff --git a/Documentation/sysctl/vm.txt b/Documentation/sysctl/vm.txt index d79eeda7a699..cd05994a49e6 100644 --- a/Documentation/sysctl/vm.txt +++ b/Documentation/sysctl/vm.txt | |||
@@ -41,7 +41,8 @@ Currently, these files are in /proc/sys/vm: | |||
41 | 41 | ||
42 | ============================================================== | 42 | ============================================================== |
43 | 43 | ||
44 | dirty_ratio, dirty_background_ratio, dirty_expire_centisecs, | 44 | dirty_bytes, dirty_ratio, dirty_background_bytes, |
45 | dirty_background_ratio, dirty_expire_centisecs, | ||
45 | dirty_writeback_centisecs, highmem_is_dirtyable, | 46 | dirty_writeback_centisecs, highmem_is_dirtyable, |
46 | vfs_cache_pressure, laptop_mode, block_dump, swap_token_timeout, | 47 | vfs_cache_pressure, laptop_mode, block_dump, swap_token_timeout, |
47 | drop-caches, hugepages_treat_as_movable: | 48 | drop-caches, hugepages_treat_as_movable: |