Skip to content

cleanups and refactor of /proc/pid/smaps*

Vlastimil Babka linux-api linux-fsdevel linux-mm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4mm: /proc/pid/*maps remove is_pid and related wrappersfs/proc/base.c fs/proc/internal.h fs/proc/task_mmu.c +1 more+18 -1440 replies
2/4mm: proc/pid/smaps: factor out mem stats gatheringfs/proc/task_mmu.c+31 -241 reply
3/4mm: proc/pid/smaps: factor out common stats printingfs/proc/task_mmu.c+29 -220 replies
4/4mm: proc/pid/smaps_rollup: convert to single value seq_filefs/proc/task_mmu.c+86 -504 replies

Reviews trailers per patch

1 of 4 patches has a Reviewed-by or Acked-by.

PatchAlexey Dobriyan
1/4
2/4
3/4
4/4R-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/4] cleanups and refactor of /proc/pid/smaps*

The recent regression in /proc/pid/smaps made me look more into the code. Especially the issues with smaps_rollup reported in [1] as explained in Patch 4, which fixes them by refactoring the code. Patches 2 and 3 are preparations for that. Patch 1 is me realizing that there's a lot of boilerplate left from times where we tried (unsuccessfuly) to mark thread stacks in the output.

Originally I had also plans to rework the translation from /proc/pid/*maps* file offsets to the internal structures. Now the offset means "vma number", which is not really stable (vma's can come and go between read() calls) and there's an extra caching of last vma's address. My idea was that offsets would be interpreted directly as addresses, which would also allow meaningful seeks (see the ugly seek_to_smaps_entry() in tools/testing/selftests/vm/mlock2.h). However loff_t is (signed) long long so that might be insufficient somewhere for the unsigned long addresses.

So the result is fixed issues with skewed /proc/pid/smaps_rollup results, simpler smaps code, and a lot of unused code removed.

[1] https://marc.info/?l=linux-mm&m=151927723128134&w=2

Vlastimil Babka (4):
mm: /proc/pid/*maps remove is_pid and related wrappers
mm: proc/pid/smaps: factor out mem stats gathering
mm: proc/pid/smaps: factor out common stats printing
mm: proc/pid/smaps_rollup: convert to single value seq_file

 fs/proc/base.c       |   6 +-
 fs/proc/internal.h   |   3 -
 fs/proc/task_mmu.c   | 294 +++++++++++++++++++------------------------
 fs/proc/task_nommu.c |  39 +-----
 4 files changed, 133 insertions(+), 209 deletions(-)
Signature · 1 line
2.18.0