Skip to content

Printbufs & shrinker OOM reporting

Kent Overstreet linux-fsdevel linux-mm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 14 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4lib/printbuf: New data structure for heap-allocated stringsinclude/linux/printbuf.h lib/Makefile lib/printbuf.c+412 -14 replies
2/4mm: Add a .to_text() method for shrinkersinclude/linux/shrinker.h mm/vmscan.c+80 -00 replies
3/4mm: Centralize & improve oom reporting in show_mem.clib/Makefile mm/Makefile mm/oom_kill.c +3 more+65 -3510 replies
4/4bcachefs: shrinker.to_text() methodsfs/bcachefs/btree_cache.c fs/bcachefs/btree_key_cache.c+30 -60 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/4] Printbufs & shrinker OOM reporting

Debugging OOMs has been one of my sources of frustration, so this patch series is an attempt to do something about it.

The first patch in the series is something I've been slowly evolving in bcachefs for years: simple heap allocated strings meant for appending to and building up structured log/error messages. They make it easy and straightforward to write pretty-printers for everything, which in turn makes good logging and error messages something that just happens naturally.

We want it here because that means the reporting I'm adding to shrinkers can be used by both OOM reporting, and for the sysfs (or is it debugfs now) interface that Roman is adding.

This patch series also:
- adds OOM reporting on shrinkers, reporting on top 10 shrinkers (in sorted order!)
- changes slab reporting to be always-on, also reporting top 10 slabs in sorted order
- starts centralizing OOM reporting in mm/show_mem.c

The last patch in the series is only a demonstration of how to implement the shrinker .to_text() method, since bcachefs isn't upstream yet.

Kent Overstreet (4):
lib/printbuf: New data structure for heap-allocated strings
mm: Add a .to_text() method for shrinkers
mm: Centralize & improve oom reporting in show_mem.c
bcachefs: shrinker.to_text() methods

 fs/bcachefs/btree_cache.c     |  18 ++-
 fs/bcachefs/btree_key_cache.c |  18 ++-
 include/linux/printbuf.h      | 140 ++++++++++++++++++
 include/linux/shrinker.h      |   5 +
 lib/Makefile                  |   4 +-
 lib/printbuf.c                | 271 ++++++++++++++++++++++++++++++++++
 mm/Makefile                   |   2 +-
 mm/oom_kill.c                 |  23 ---
 {lib => mm}/show_mem.c        |  14 ++
 mm/slab.h                     |   6 +-
 mm/slab_common.c              |  53 ++++++-
 mm/vmscan.c                   |  75 ++++++++++
 12 files changed, 587 insertions(+), 42 deletions(-)
 create mode 100644 include/linux/printbuf.h
 create mode 100644 lib/printbuf.c
 rename {lib => mm}/show_mem.c (78%)
Signature · 1 line
2.35.2