Buddy allocator statistics





Buddy allocator collets some statistics (ext4_mb_collect_stats()).

There are counters in ext4 superblock info:

  • s_bal_reqs – number of requests > 1
  • s_bal_allocated – found enough chunk
  • s_bal_ex_scanned – how much extents scanned
  • s_bal_goals – block is allocated from goal
  • s_bal_breaks – allocator was interrupted (because of s_mb_max_to_scan)
  • s_bal_2orders – 2^orders hits

Statistic is show on fs unmount (ext4_mb_release()) if /sys/fs/ext4/_partition_/mb_stats is set.

It looks that for the same IO rate s_bal_allocated/s_bal_ex_scanned can show how effective allocator at some period of time.

There is seq-file with details

[root@localhost cray-lustre]# cat /proc/fs/ldiskfs/loop1/mb_groups 
#group: bfree gfree frags first pa   [ 2^0   2^1   2^2   2^3   2^4   2^5   2^6   2^7   2^8   2^9   2^10  2^11  2^12  2^13  ]
#0    : 25017 25017 1     7367  0     [ 1     0     0     1     1     1     0     1     1     2     1     1     1     2     ]
#1    : 30397 31266 2     2048  2     [ 1     0     1     1     1     1     2     2     1     0     1     2     2     2     ]
#2    : 28352 28352 1     4096  0     [ 0     0     0     0     0     0     1     1     0     1     1     1     2     2     ]
#3    : 1632  1632  1     1024  0     [ 0     0     0     0     0     1     1     0     0     1     1     0     0     0     ]