[PATCH 0/7] shrinker debugging improvements

From: Kent Overstreet
Date: Wed Nov 22 2023 - 18:25:29 EST


This patchset does a few things to aid in OOM debugging, in particular
when shrinkers are involved:

- improves the show_mem OOM report: it now reports on shrinkers, and
for both shrinkers and slab we only report the top 10 entries,
sorted, not the full list

- add shrinker_to_text(), for the show_mem report and debugfs, and a
an optional shrinker.to_text() callback to report extra
driver-specific information

- add extra counters for the shrinker_to_text() report

- implement shrinker.to_text() for bcachefs, giving an example of how
to use the callbacks

Daniel Hill (1):
bcachefs: add counters for failed shrinker reclaim

Kent Overstreet (6):
seq_buf: seq_buf_human_readable_u64()
mm: shrinker: Add a .to_text() method for shrinkers
mm: shrinker: Add new stats for .to_text()
mm: Centralize & improve oom reporting in show_mem.c
mm: shrinker: Add shrinker_to_text() to debugfs interface
bcachefs: shrinker.to_text() methods

fs/bcachefs/btree_cache.c | 102 +++++++++++++++++++++++++++-------
fs/bcachefs/btree_cache.h | 2 +-
fs/bcachefs/btree_key_cache.c | 14 +++++
fs/bcachefs/btree_types.h | 10 ++++
fs/bcachefs/sysfs.c | 2 +-
include/linux/seq_buf.h | 4 ++
include/linux/shrinker.h | 12 +++-
lib/seq_buf.c | 10 ++++
mm/oom_kill.c | 23 --------
mm/show_mem.c | 20 +++++++
mm/shrinker.c | 89 ++++++++++++++++++++++++++++-
mm/shrinker_debug.c | 18 ++++++
mm/slab.h | 6 +-
mm/slab_common.c | 52 ++++++++++++++---
14 files changed, 305 insertions(+), 59 deletions(-)

--
2.42.0