Skip to content

Commit a111c96

Browse files
Daisuke Nishimuratorvalds
authored andcommitted
memcg: update documentation to describe usage_in_bytes
Since 569b846 ("memcg: coalesce uncharge during unmap/truncate"), we do batched (delayed) uncharge at truncation/unmap. And since cdec2e4(memcg: coalesce charging via percpu storage), we have percpu cache for res_counter. These changes improved performance of memory cgroup very much, but made res_counter->usage usually have a bigger value than the actual value of memory usage. So, *.usage_in_bytes, which show res_counter->usage, are not desirable for precise values of memory(and swap) usage anymore. Instead of removing these files completely(because we cannot know res_counter->usage without them), this patch updates the meaning of those files. Signed-off-by: Daisuke Nishimura <[email protected]> Acked-by: KAMEZAWA Hiroyuki <[email protected]> Acked-by: Michal Hocko <[email protected]> Cc: Balbir Singh <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 98909cf commit a111c96

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

Documentation/cgroups/memory.txt

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@ Brief summary of control files.
5252
tasks # attach a task(thread) and show list of threads
5353
cgroup.procs # show list of processes
5454
cgroup.event_control # an interface for event_fd()
55-
memory.usage_in_bytes # show current memory(RSS+Cache) usage.
56-
memory.memsw.usage_in_bytes # show current memory+Swap usage
55+
memory.usage_in_bytes # show current res_counter usage for memory
56+
(See 5.5 for details)
57+
memory.memsw.usage_in_bytes # show current res_counter usage for memory+Swap
58+
(See 5.5 for details)
5759
memory.limit_in_bytes # set/show limit of memory usage
5860
memory.memsw.limit_in_bytes # set/show limit of memory+Swap usage
5961
memory.failcnt # show the number of memory usage hits limits
@@ -453,6 +455,15 @@ memory under it will be reclaimed.
453455
You can reset failcnt by writing 0 to failcnt file.
454456
# echo 0 > .../memory.failcnt
455457

458+
5.5 usage_in_bytes
459+
460+
For efficiency, as other kernel components, memory cgroup uses some optimization
461+
to avoid unnecessary cacheline false sharing. usage_in_bytes is affected by the
462+
method and doesn't show 'exact' value of memory(and swap) usage, it's an fuzz
463+
value for efficient access. (Of course, when necessary, it's synchronized.)
464+
If you want to know more exact memory usage, you should use RSS+CACHE(+SWAP)
465+
value in memory.stat(see 5.2).
466+
456467
6. Hierarchy support
457468

458469
The memory controller supports a deep hierarchy and hierarchical accounting.

0 commit comments

Comments
 (0)