mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
docs/vm: zsmalloc.txt: convert to ReST format
Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
This commit is contained in:
parent
44bc09eb3e
commit
2a05c58bf9
1 changed files with 36 additions and 24 deletions
|
@ -1,5 +1,8 @@
|
||||||
|
.. _zsmalloc:
|
||||||
|
|
||||||
|
========
|
||||||
zsmalloc
|
zsmalloc
|
||||||
--------
|
========
|
||||||
|
|
||||||
This allocator is designed for use with zram. Thus, the allocator is
|
This allocator is designed for use with zram. Thus, the allocator is
|
||||||
supposed to work well under low memory conditions. In particular, it
|
supposed to work well under low memory conditions. In particular, it
|
||||||
|
@ -31,40 +34,49 @@ be mapped using zs_map_object() to get a usable pointer and subsequently
|
||||||
unmapped using zs_unmap_object().
|
unmapped using zs_unmap_object().
|
||||||
|
|
||||||
stat
|
stat
|
||||||
----
|
====
|
||||||
|
|
||||||
With CONFIG_ZSMALLOC_STAT, we could see zsmalloc internal information via
|
With CONFIG_ZSMALLOC_STAT, we could see zsmalloc internal information via
|
||||||
/sys/kernel/debug/zsmalloc/<user name>. Here is a sample of stat output:
|
``/sys/kernel/debug/zsmalloc/<user name>``. Here is a sample of stat output::
|
||||||
|
|
||||||
# cat /sys/kernel/debug/zsmalloc/zram0/classes
|
# cat /sys/kernel/debug/zsmalloc/zram0/classes
|
||||||
|
|
||||||
class size almost_full almost_empty obj_allocated obj_used pages_used pages_per_zspage
|
class size almost_full almost_empty obj_allocated obj_used pages_used pages_per_zspage
|
||||||
..
|
...
|
||||||
..
|
...
|
||||||
9 176 0 1 186 129 8 4
|
9 176 0 1 186 129 8 4
|
||||||
10 192 1 0 2880 2872 135 3
|
10 192 1 0 2880 2872 135 3
|
||||||
11 208 0 1 819 795 42 2
|
11 208 0 1 819 795 42 2
|
||||||
12 224 0 1 219 159 12 4
|
12 224 0 1 219 159 12 4
|
||||||
..
|
...
|
||||||
..
|
...
|
||||||
|
|
||||||
|
|
||||||
class: index
|
class
|
||||||
size: object size zspage stores
|
index
|
||||||
almost_empty: the number of ZS_ALMOST_EMPTY zspages(see below)
|
size
|
||||||
almost_full: the number of ZS_ALMOST_FULL zspages(see below)
|
object size zspage stores
|
||||||
obj_allocated: the number of objects allocated
|
almost_empty
|
||||||
obj_used: the number of objects allocated to the user
|
the number of ZS_ALMOST_EMPTY zspages(see below)
|
||||||
pages_used: the number of pages allocated for the class
|
almost_full
|
||||||
pages_per_zspage: the number of 0-order pages to make a zspage
|
the number of ZS_ALMOST_FULL zspages(see below)
|
||||||
|
obj_allocated
|
||||||
|
the number of objects allocated
|
||||||
|
obj_used
|
||||||
|
the number of objects allocated to the user
|
||||||
|
pages_used
|
||||||
|
the number of pages allocated for the class
|
||||||
|
pages_per_zspage
|
||||||
|
the number of 0-order pages to make a zspage
|
||||||
|
|
||||||
We assign a zspage to ZS_ALMOST_EMPTY fullness group when:
|
We assign a zspage to ZS_ALMOST_EMPTY fullness group when n <= N / f, where
|
||||||
n <= N / f, where
|
|
||||||
n = number of allocated objects
|
* n = number of allocated objects
|
||||||
N = total number of objects zspage can store
|
* N = total number of objects zspage can store
|
||||||
f = fullness_threshold_frac(ie, 4 at the moment)
|
* f = fullness_threshold_frac(ie, 4 at the moment)
|
||||||
|
|
||||||
Similarly, we assign zspage to:
|
Similarly, we assign zspage to:
|
||||||
ZS_ALMOST_FULL when n > N / f
|
|
||||||
ZS_EMPTY when n == 0
|
* ZS_ALMOST_FULL when n > N / f
|
||||||
ZS_FULL when n == N
|
* ZS_EMPTY when n == 0
|
||||||
|
* ZS_FULL when n == N
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue