diff options
author | KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> | 2011-07-26 19:08:26 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-26 19:49:42 -0400 |
commit | 82f9d486e59f588c7d100865c36510644abda356 (patch) | |
tree | 266f3dcf4f57538196bddd77a129adfb2752335b /Documentation/cgroups | |
parent | 108b6a78463bb8c7163e4f9779f36ad8bbade334 (diff) |
memcg: add memory.vmscan_stat
The commit log of 0ae5e89c60c9 ("memcg: count the soft_limit reclaim
in...") says it adds scanning stats to memory.stat file. But it doesn't
because we considered we needed to make a concensus for such new APIs.
This patch is a trial to add memory.scan_stat. This shows
- the number of scanned pages(total, anon, file)
- the number of rotated pages(total, anon, file)
- the number of freed pages(total, anon, file)
- the number of elaplsed time (including sleep/pause time)
for both of direct/soft reclaim.
The biggest difference with oringinal Ying's one is that this file
can be reset by some write, as
# echo 0 ...../memory.scan_stat
Example of output is here. This is a result after make -j 6 kernel
under 300M limit.
[kamezawa@bluextal ~]$ cat /cgroup/memory/A/memory.scan_stat
[kamezawa@bluextal ~]$ cat /cgroup/memory/A/memory.vmscan_stat
scanned_pages_by_limit 9471864
scanned_anon_pages_by_limit 6640629
scanned_file_pages_by_limit 2831235
rotated_pages_by_limit 4243974
rotated_anon_pages_by_limit 3971968
rotated_file_pages_by_limit 272006
freed_pages_by_limit 2318492
freed_anon_pages_by_limit 962052
freed_file_pages_by_limit 1356440
elapsed_ns_by_limit 351386416101
scanned_pages_by_system 0
scanned_anon_pages_by_system 0
scanned_file_pages_by_system 0
rotated_pages_by_system 0
rotated_anon_pages_by_system 0
rotated_file_pages_by_system 0
freed_pages_by_system 0
freed_anon_pages_by_system 0
freed_file_pages_by_system 0
elapsed_ns_by_system 0
scanned_pages_by_limit_under_hierarchy 9471864
scanned_anon_pages_by_limit_under_hierarchy 6640629
scanned_file_pages_by_limit_under_hierarchy 2831235
rotated_pages_by_limit_under_hierarchy 4243974
rotated_anon_pages_by_limit_under_hierarchy 3971968
rotated_file_pages_by_limit_under_hierarchy 272006
freed_pages_by_limit_under_hierarchy 2318492
freed_anon_pages_by_limit_under_hierarchy 962052
freed_file_pages_by_limit_under_hierarchy 1356440
elapsed_ns_by_limit_under_hierarchy 351386416101
scanned_pages_by_system_under_hierarchy 0
scanned_anon_pages_by_system_under_hierarchy 0
scanned_file_pages_by_system_under_hierarchy 0
rotated_pages_by_system_under_hierarchy 0
rotated_anon_pages_by_system_under_hierarchy 0
rotated_file_pages_by_system_under_hierarchy 0
freed_pages_by_system_under_hierarchy 0
freed_anon_pages_by_system_under_hierarchy 0
freed_file_pages_by_system_under_hierarchy 0
elapsed_ns_by_system_under_hierarchy 0
total_xxxx is for hierarchy management.
This will be useful for further memcg developments and need to be
developped before we do some complicated rework on LRU/softlimit
management.
This patch adds a new struct memcg_scanrecord into scan_control struct.
sc->nr_scanned at el is not designed for exporting information. For
example, nr_scanned is reset frequentrly and incremented +2 at scanning
mapped pages.
To avoid complexity, I added a new param in scan_control which is for
exporting scanning score.
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Ying Han <yinghan@google.com>
Cc: Andrew Bresticker <abrestic@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Documentation/cgroups')
-rw-r--r-- | Documentation/cgroups/memory.txt | 85 |
1 files changed, 84 insertions, 1 deletions
diff --git a/Documentation/cgroups/memory.txt b/Documentation/cgroups/memory.txt index 06eb6d957c83..6f3c598971fc 100644 --- a/Documentation/cgroups/memory.txt +++ b/Documentation/cgroups/memory.txt | |||
@@ -380,7 +380,7 @@ will be charged as a new owner of it. | |||
380 | 380 | ||
381 | 5.2 stat file | 381 | 5.2 stat file |
382 | 382 | ||
383 | memory.stat file includes following statistics | 383 | 5.2.1 memory.stat file includes following statistics |
384 | 384 | ||
385 | # per-memory cgroup local status | 385 | # per-memory cgroup local status |
386 | cache - # of bytes of page cache memory. | 386 | cache - # of bytes of page cache memory. |
@@ -438,6 +438,89 @@ Note: | |||
438 | file_mapped is accounted only when the memory cgroup is owner of page | 438 | file_mapped is accounted only when the memory cgroup is owner of page |
439 | cache.) | 439 | cache.) |
440 | 440 | ||
441 | 5.2.2 memory.vmscan_stat | ||
442 | |||
443 | memory.vmscan_stat includes statistics information for memory scanning and | ||
444 | freeing, reclaiming. The statistics shows memory scanning information since | ||
445 | memory cgroup creation and can be reset to 0 by writing 0 as | ||
446 | |||
447 | #echo 0 > ../memory.vmscan_stat | ||
448 | |||
449 | This file contains following statistics. | ||
450 | |||
451 | [param]_[file_or_anon]_pages_by_[reason]_[under_heararchy] | ||
452 | [param]_elapsed_ns_by_[reason]_[under_hierarchy] | ||
453 | |||
454 | For example, | ||
455 | |||
456 | scanned_file_pages_by_limit indicates the number of scanned | ||
457 | file pages at vmscan. | ||
458 | |||
459 | Now, 3 parameters are supported | ||
460 | |||
461 | scanned - the number of pages scanned by vmscan | ||
462 | rotated - the number of pages activated at vmscan | ||
463 | freed - the number of pages freed by vmscan | ||
464 | |||
465 | If "rotated" is high against scanned/freed, the memcg seems busy. | ||
466 | |||
467 | Now, 2 reason are supported | ||
468 | |||
469 | limit - the memory cgroup's limit | ||
470 | system - global memory pressure + softlimit | ||
471 | (global memory pressure not under softlimit is not handled now) | ||
472 | |||
473 | When under_hierarchy is added in the tail, the number indicates the | ||
474 | total memcg scan of its children and itself. | ||
475 | |||
476 | elapsed_ns is a elapsed time in nanosecond. This may include sleep time | ||
477 | and not indicates CPU usage. So, please take this as just showing | ||
478 | latency. | ||
479 | |||
480 | Here is an example. | ||
481 | |||
482 | # cat /cgroup/memory/A/memory.vmscan_stat | ||
483 | scanned_pages_by_limit 9471864 | ||
484 | scanned_anon_pages_by_limit 6640629 | ||
485 | scanned_file_pages_by_limit 2831235 | ||
486 | rotated_pages_by_limit 4243974 | ||
487 | rotated_anon_pages_by_limit 3971968 | ||
488 | rotated_file_pages_by_limit 272006 | ||
489 | freed_pages_by_limit 2318492 | ||
490 | freed_anon_pages_by_limit 962052 | ||
491 | freed_file_pages_by_limit 1356440 | ||
492 | elapsed_ns_by_limit 351386416101 | ||
493 | scanned_pages_by_system 0 | ||
494 | scanned_anon_pages_by_system 0 | ||
495 | scanned_file_pages_by_system 0 | ||
496 | rotated_pages_by_system 0 | ||
497 | rotated_anon_pages_by_system 0 | ||
498 | rotated_file_pages_by_system 0 | ||
499 | freed_pages_by_system 0 | ||
500 | freed_anon_pages_by_system 0 | ||
501 | freed_file_pages_by_system 0 | ||
502 | elapsed_ns_by_system 0 | ||
503 | scanned_pages_by_limit_under_hierarchy 9471864 | ||
504 | scanned_anon_pages_by_limit_under_hierarchy 6640629 | ||
505 | scanned_file_pages_by_limit_under_hierarchy 2831235 | ||
506 | rotated_pages_by_limit_under_hierarchy 4243974 | ||
507 | rotated_anon_pages_by_limit_under_hierarchy 3971968 | ||
508 | rotated_file_pages_by_limit_under_hierarchy 272006 | ||
509 | freed_pages_by_limit_under_hierarchy 2318492 | ||
510 | freed_anon_pages_by_limit_under_hierarchy 962052 | ||
511 | freed_file_pages_by_limit_under_hierarchy 1356440 | ||
512 | elapsed_ns_by_limit_under_hierarchy 351386416101 | ||
513 | scanned_pages_by_system_under_hierarchy 0 | ||
514 | scanned_anon_pages_by_system_under_hierarchy 0 | ||
515 | scanned_file_pages_by_system_under_hierarchy 0 | ||
516 | rotated_pages_by_system_under_hierarchy 0 | ||
517 | rotated_anon_pages_by_system_under_hierarchy 0 | ||
518 | rotated_file_pages_by_system_under_hierarchy 0 | ||
519 | freed_pages_by_system_under_hierarchy 0 | ||
520 | freed_anon_pages_by_system_under_hierarchy 0 | ||
521 | freed_file_pages_by_system_under_hierarchy 0 | ||
522 | elapsed_ns_by_system_under_hierarchy 0 | ||
523 | |||
441 | 5.3 swappiness | 524 | 5.3 swappiness |
442 | 525 | ||
443 | Similar to /proc/sys/vm/swappiness, but affecting a hierarchy of groups only. | 526 | Similar to /proc/sys/vm/swappiness, but affecting a hierarchy of groups only. |