Skip to content

alloc_tag: fix a leak and a deadlock around shutdown_mem_profiling()

Hao Ge linux-mm lkml stable 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest posting 2/22 patches 7 repliesIn review
  2. v2 posting 1/20 of 2 patches 0 repliesSuperseded
  3. v1 RFC3 patches 6 repliesSuperseded

Patches in v2 posting 2/2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2alloc_tag: skip percpu counter allocation when profiling is disabledlib/codetag.c mm/alloc_tag.c+12 -21 reply
2/2alloc_tag: remove /proc/allocinfo outside of mod_lockmm/alloc_tag.c+9 -11 reply

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchSuren Baghdasaryan
1/2A-b
2/2A-b

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

Read the v2 thread

Cover letter [PATCH v2 0/2] alloc_tag: fix a leak and a deadlock around shutdown_mem_profiling()

Two fixes for issues reported by sashiko:

1. percpu counter leak on modules loaded after profiling is disabled.
2. AB-BA deadlock between module load and /proc/allocinfo readers.

Changes since the RFC [2]:

- The "move codetag section placement decision to layout_sections()" patch is dropped from this series. Its retry path depends on [1], so it will be sent as part of that patchset instead.
- Patch 1 now returns -EOPNOTSUPP instead of introducing CODETAG_MODULE_LOAD/CODETAG_MODULE_EXCLUDED defines (suggested by Suren).
- Reported-by tags added.

Patch 1 skips percpu counter allocation when profiling is disabled, so the module loads without its tags instead of leaking counters. Patch 2 defers remove_proc_entry() to a workqueue.

[1]: https://lore.kernel.org/all/[email protected]/
[2]: https://lore.kernel.org/all/[email protected]/

Hao Ge (2):
alloc_tag: skip percpu counter allocation when profiling is disabled
alloc_tag: remove /proc/allocinfo outside of mod_lock

 lib/codetag.c  | 10 ++++++++--
 mm/alloc_tag.c | 14 ++++++++++++-
 2 files changed, 21 insertions(+), 3 deletions(-)

--
2.25.1