Skip to content
  • Sergey Senozhatsky's avatar
    mm/zsmalloc: add `freeable' column to pool stat · 1120ed54
    Sergey Senozhatsky authored
    
    
    Add a new column to pool stats, which will tell how many pages ideally
    can be freed by class compaction, so it will be easier to analyze
    zsmalloc fragmentation.
    
    At the moment, we have only numbers of FULL and ALMOST_EMPTY classes,
    but they don't tell us how badly the class is fragmented internally.
    
    The new /sys/kernel/debug/zsmalloc/zramX/classes output look as follows:
    
     class  size almost_full almost_empty obj_allocated   obj_used pages_used pages_per_zspage freeable
    [..]
        12   224           0            2           146          5          8                4        4
        13   240           0            0             0          0          0                1        0
        14   256           1           13          1840       1672        115                1       10
        15   272           0            0             0          0          0                1        0
    [..]
        49   816           0            3           745        735        149                1        2
        51   848           3            4           361        306         76                4        8
        52   864          12           14           378        268         81                3       21
        54   896           1           12           117         57         26                2       12
        57   944           0            0             0          0          0                3        0
    [..]
     Total                26          131         12709      10994       1071                       134
    
    For example, from this particular output we can easily conclude that
    class-896 is heavily fragmented -- it occupies 26 pages, 12 can be freed
    by compaction.
    
    Signed-off-by: default avatarSergey Senozhatsky <sergey.senozhatsky@gmail.com>
    Acked-by: default avatarMinchan Kim <minchan@kernel.org>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    1120ed54