[PATCH v2 0/4] mm/slub: preserve previous object lifetime

Pengpeng Hou <[email protected]>
Newsgroups org.kernel.vger.linux-doc,org.kernel.vger.linux-kernel,org.kvack.linux-mm
Message-ID <[email protected]>
SLAB_STORE_USER records one allocation and one free track per object.  A
new allocation overwrites the allocation track, and a later stale free can
overwrite the free track, so the completed lifetime that produced the
stale reference is no longer available in the report.

Extend the existing U option directly, as discussed on the RFC, to retain
one previous completed allocation/free pair.  The records remain address
history only; they do not infer semantic ownership.  The series also adds
KUnit coverage and documents the additional report section.

Changes since v1:
https://lore.kernel.org/all/[email protected]/
- extend U directly instead of adding a separate H option
- use TRACK_NR in every user-metadata layout calculation
- copy the completed pair with explicit track assignments
- keep the current free track until a later free replaces it
- pin the KUnit task across immediate free and reuse

Testing used Linux 3d6d817622b0, GCC 13.3 and QEMU 8.2.2 for x86_64.
The focused SLUB KUnit test passed, including immediate free/reuse and
verification that the completed allocation/free pair moved to the
previous-lifetime slots.

A temporary KUnit probe, not part of this series, recorded the internal
cache slot size and objects per order-0 slab before and after the series:

  object bytes    U slot/objects    patched slot/objects
       32              96/42              160/25
       64             128/32              192/21
      128             192/21              256/16
      256             320/12              384/10

All four caches retained slab order 0.  The table quantifies the expected
per-object metadata cost only for caches using SLAB_STORE_USER; caches
without U do not allocate these track records.

Pengpeng Hou (4):
  mm/slub: use a track count for user metadata sizing
  mm/slub: preserve one previous object lifetime
  mm/slub: test previous lifetime tracking
  Documentation/mm: describe SLUB previous lifetime tracking

 Documentation/admin-guide/mm/slab.rst | 13 ++++-
 lib/tests/slub_kunit.c                | 35 ++++++++++++++
 mm/slab.h                             |  4 ++
 mm/slub.c                             | 69 ++++++++++++++++++++-------
 4 files changed, 104 insertions(+), 17 deletions(-)


base-commit: 3d6d817622b0a9721e3cc404df3469171582be13
-- 
2.50.1 (Apple Git-155)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.