diff options
author | Yasunori Goto <y-goto@jp.fujitsu.com> | 2008-02-05 01:29:32 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-05 12:44:19 -0500 |
commit | 7786fa9ac5366214fb942a9e62c6e46b4272c22c (patch) | |
tree | dafa4440d5607d3481d512b17f2b764a4fefa29d | |
parent | b5beb1caff4ce063e6e2dc13f23b80eeef4e9782 (diff) |
Document lowmem_reserve_ratio
Though the lower_zone_protection was changed to lowmem_reserve_ratio, the
document has been not changed. The lowmem_reserve_ratio seems quite hard
to estimate, but there is no guidance. This patch is to change document
for it.
Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com>
Cc: Andrea Arcangeli <andrea@cpushare.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | Documentation/filesystems/proc.txt | 80 |
1 files changed, 63 insertions, 17 deletions
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt index 07231afca72d..e2799b5fafea 100644 --- a/Documentation/filesystems/proc.txt +++ b/Documentation/filesystems/proc.txt | |||
@@ -1336,7 +1336,7 @@ legacy_va_layout | |||
1336 | If non-zero, this sysctl disables the new 32-bit mmap mmap layout - the kernel | 1336 | If non-zero, this sysctl disables the new 32-bit mmap mmap layout - the kernel |
1337 | will use the legacy (2.4) layout for all processes. | 1337 | will use the legacy (2.4) layout for all processes. |
1338 | 1338 | ||
1339 | lower_zone_protection | 1339 | lowmem_reserve_ratio |
1340 | --------------------- | 1340 | --------------------- |
1341 | 1341 | ||
1342 | For some specialised workloads on highmem machines it is dangerous for | 1342 | For some specialised workloads on highmem machines it is dangerous for |
@@ -1356,25 +1356,71 @@ captured into pinned user memory. | |||
1356 | mechanism will also defend that region from allocations which could use | 1356 | mechanism will also defend that region from allocations which could use |
1357 | highmem or lowmem). | 1357 | highmem or lowmem). |
1358 | 1358 | ||
1359 | The `lower_zone_protection' tunable determines how aggressive the kernel is | 1359 | The `lowmem_reserve_ratio' tunable determines how aggressive the kernel is |
1360 | in defending these lower zones. The default value is zero - no | 1360 | in defending these lower zones. |
1361 | protection at all. | ||
1362 | 1361 | ||
1363 | If you have a machine which uses highmem or ISA DMA and your | 1362 | If you have a machine which uses highmem or ISA DMA and your |
1364 | applications are using mlock(), or if you are running with no swap then | 1363 | applications are using mlock(), or if you are running with no swap then |
1365 | you probably should increase the lower_zone_protection setting. | 1364 | you probably should change the lowmem_reserve_ratio setting. |
1366 | 1365 | ||
1367 | The units of this tunable are fairly vague. It is approximately equal | 1366 | The lowmem_reserve_ratio is an array. You can see them by reading this file. |
1368 | to "megabytes," so setting lower_zone_protection=100 will protect around 100 | 1367 | - |
1369 | megabytes of the lowmem zone from user allocations. It will also make | 1368 | % cat /proc/sys/vm/lowmem_reserve_ratio |
1370 | those 100 megabytes unavailable for use by applications and by | 1369 | 256 256 32 |
1371 | pagecache, so there is a cost. | 1370 | - |
1372 | 1371 | Note: # of this elements is one fewer than number of zones. Because the highest | |
1373 | The effects of this tunable may be observed by monitoring | 1372 | zone's value is not necessary for following calculation. |
1374 | /proc/meminfo:LowFree. Write a single huge file and observe the point | 1373 | |
1375 | at which LowFree ceases to fall. | 1374 | But, these values are not used directly. The kernel calculates # of protection |
1376 | 1375 | pages for each zones from them. These are shown as array of protection pages | |
1377 | A reasonable value for lower_zone_protection is 100. | 1376 | in /proc/zoneinfo like followings. (This is an example of x86-64 box). |
1377 | Each zone has an array of protection pages like this. | ||
1378 | |||
1379 | - | ||
1380 | Node 0, zone DMA | ||
1381 | pages free 1355 | ||
1382 | min 3 | ||
1383 | low 3 | ||
1384 | high 4 | ||
1385 | : | ||
1386 | : | ||
1387 | numa_other 0 | ||
1388 | protection: (0, 2004, 2004, 2004) | ||
1389 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
1390 | pagesets | ||
1391 | cpu: 0 pcp: 0 | ||
1392 | : | ||
1393 | - | ||
1394 | These protections are added to score to judge whether this zone should be used | ||
1395 | for page allocation or should be reclaimed. | ||
1396 | |||
1397 | In this example, if normal pages (index=2) are required to this DMA zone and | ||
1398 | pages_high is used for watermark, the kernel judges this zone should not be | ||
1399 | used because pages_free(1355) is smaller than watermark + protection[2] | ||
1400 | (4 + 2004 = 2008). If this protection value is 0, this zone would be used for | ||
1401 | normal page requirement. If requirement is DMA zone(index=0), protection[0] | ||
1402 | (=0) is used. | ||
1403 | |||
1404 | zone[i]'s protection[j] is calculated by following exprssion. | ||
1405 | |||
1406 | (i < j): | ||
1407 | zone[i]->protection[j] | ||
1408 | = (total sums of present_pages from zone[i+1] to zone[j] on the node) | ||
1409 | / lowmem_reserve_ratio[i]; | ||
1410 | (i = j): | ||
1411 | (should not be protected. = 0; | ||
1412 | (i > j): | ||
1413 | (not necessary, but looks 0) | ||
1414 | |||
1415 | The default values of lowmem_reserve_ratio[i] are | ||
1416 | 256 (if zone[i] means DMA or DMA32 zone) | ||
1417 | 32 (others). | ||
1418 | As above expression, they are reciprocal number of ratio. | ||
1419 | 256 means 1/256. # of protection pages becomes about "0.39%" of total present | ||
1420 | pages of higher zones on the node. | ||
1421 | |||
1422 | If you would like to protect more pages, smaller values are effective. | ||
1423 | The minimum value is 1 (1/1 -> 100%). | ||
1378 | 1424 | ||
1379 | page-cluster | 1425 | page-cluster |
1380 | ------------ | 1426 | ------------ |