Skip to content

alloc_tag: add per-numa node stats

Casey Chen linux-mm 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest0 of 1 patch 18 repliesIn review

Patches in v1 No applies recorded yet

The patch the cover letter announces is not in this archive.

Reviews trailers per patch

PatchYuanyuan Zhong
SeriesR-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/1] alloc_tag: add per-numa node stats

The patch is based 4aab42ee1e4e ("mm/zblock: make active_list rcu_list") from branch mm-new of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

The patch adds per-NUMA alloc_tag stats. Bytes/calls in total and per-NUMA nodes are displayed in a single row for each alloc_tag in /proc/allocinfo. Also percpu allocation is marked and its stats is stored on NUMA node 0. For example, the resulting file looks like below.

percpu y total         8588     2147 numa0         8588     2147 numa1            0        0 kernel/irq/irqdesc.c:425 func:alloc_desc
percpu n total       447232     1747 numa0       269568     1053 numa1       177664      694 lib/maple_tree.c:165 func:mt_alloc_bulk
percpu n total        83200      325 numa0        30976      121 numa1        52224      204 lib/maple_tree.c:160 func:mt_alloc_one
...
percpu n total       364800     5700 numa0       109440     1710 numa1       255360     3990 drivers/net/ethernet/mellanox/mlx5/core/cmd.c:1410 [mlx5_core] func:mlx5_alloc_cmd_msg
percpu n total      1249280    39040 numa0       374784    11712 numa1       874496    27328 drivers/net/ethernet/mellanox/mlx5/core/cmd.c:1376 [mlx5_core] func:alloc_cmd_box

To save memory, we dynamically allocate per-NUMA node stats counter once the system boots up and knows how many NUMA nodes available. percpu allocators are used for memory allocation hence increase PERCPU_DYNAMIC_RESERVE.

For in-kernel alloc_tags, pcpu_alloc_noprof() is called so the memory for these counters are not accounted in profiling stats.

For loadable modules, __alloc_percpu_gfp() is called and memory is accounted.

percpu y total 17024 532 numa0 17024 532 numa1 0 0 lib/alloc_tag.c:564 func:load_module

Casey Chen (1):
alloc_tag: add per-numa node stats

 include/linux/alloc_tag.h | 48 +++++++++++++++++++++++++++------------
 include/linux/codetag.h   |  4 ++++
 include/linux/percpu.h    |  2 +-
 lib/alloc_tag.c           | 41 +++++++++++++++++++++++++++------
 mm/page_alloc.c           | 35 ++++++++++++++--------------
 mm/percpu.c               |  8 +++++--
 mm/show_mem.c             | 21 ++++++++++++-----
 mm/slub.c                 | 10 +++++---
 8 files changed, 119 insertions(+), 50 deletions(-)
Signature · 1 line
2.34.1