diff options
author | Lama Kayal <[email protected]> | 2021-09-22 09:32:33 +0300 |
---|---|---|
committer | Saeed Mahameed <[email protected]> | 2021-12-21 19:08:58 -0800 |
commit | fa691d0c9c0812b9045f3a9420862e47b3b92518 (patch) | |
tree | 64b923181ad56df4cfaf4c551664afa887f4bff2 /tools/perf/scripts/python/libxed.py | |
parent | be98737a4faa3a0dc1781ced5bbf5c47865e29d7 (diff) |
net/mlx5e: Allocate per-channel stats dynamically at first usage
Make stats allocation per-channel dynamic on demand, at channel open
operation.
Previously the stats array was pre-allocated for the maximum possible
number of channels. Here we defer the per-channel stats instance allocation
upon its first usage, so that it's allocated only if really needed.
Allocating stats on demand helps maintain a more memory-efficient code,
as we're saving memory when the used number of channels is smaller than
the maximum.
The stats memory instances are still freed in mlx5e_priv_arrays_free(),
so that they are persistent to channels' closure.
Memory size allocated for struct mlx5e_channel_stats is 3648 bytes.
If maximum number of channel stands for 64, the total memory space
allocated for stats is 3648x64 = 228K bytes. In scenarios where the
number of channels in use is significantly smaller than maximum number,
the memory saved can be remarkable.
Signed-off-by: Lama Kayal <[email protected]>
Reviewed-by: Tariq Toukan <[email protected]>
Signed-off-by: Saeed Mahameed <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/libxed.py')
0 files changed, 0 insertions, 0 deletions