[GIT PULL] slab updates for 6.2-rc1

From: Vlastimil Babka
Date: Fri Dec 09 2022 - 10:33:02 EST


Linus,

please pull the latest slab updates from:

git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab.git tags/slab-for-6.2-rc1

The changes, including the first step to remove SLOB, are summarized below.

There's one trivial conflict with percpu tree:
https://lore.kernel.org/all/20221122163634.3b21cf71@xxxxxxxxxxxxxxxx/

======================================

* SLOB deprecation and SLUB_TINY

The SLOB allocator adds maintenance burden and stands in the way of API
improvements [1]. Deprecate it by renaming the config option (to make users
notice) to CONFIG_SLOB_DEPRECATED with updated help text. SLUB should be
used instead as SLAB will be the next on the removal list.

Based on reports from a riscv k210 board with 8MB RAM, add a CONFIG_SLUB_TINY
option to minimize SLUB's memory usage at the expense of scalability. This
has resolved the k210 regression [2] so in case there are no others (that
wouldn't be resolvable by further tweaks to SLUB_TINY) plan is to remove SLOB
in a few cycles.

Existing defconfigs with CONFIG_SLOB are converted to CONFIG_SLUB_TINY.

* kmalloc() slub_debug redzone improvements

A series from Feng Tang that builds on the tracking or requested size for
kmalloc() allocations (for caches with debugging enabled) added in 6.1, to
make redzone checks consider the requested size and not the rounded up one,
in order to catch more subtle buffer overruns. Includes new slub_kunit test.

* struct slab fields reordering to accomodate larger rcu_head

RCU folks would like to grow rcu_head with debugging options, which breaks
current struct slab layout's assumptions, so reorganize it to make this
possible.

* Miscellaneous improvements/fixes

- __alloc_size checking compiler workaround by Kees Cook.
- Optimize and cleanup SLUB's sysfs init, by Rasmus Villemoes.
- Make SLAB compatible with PROVE_RAW_LOCK_NESTING, by Jiri Kosina.
- Correct SLUB's percpu allocation estimates, by Baoquan He.
- Re-enableS LUB's run-time failslab sysfs control, by Alexander Atanasov.
- Make tools/vm/slabinfo more user friendly when not run as root, by Rong Tao.
- Dead code removal in SLUB, by Hyeonggon Yoo.

[1] https://lore.kernel.org/all/b35c3f82-f67b-2103-7d82-7a7ba7521439@xxxxxxx/
[2] https://lore.kernel.org/all/6a1883c4-4c3f-545a-90e8-2cd805bcf4ae@xxxxxxxxxxxxxxxxxx/

----------------------------------------------------------------
Alexander Atanasov (1):
mm: Make failslab writable again

Baoquan He (2):
percpu: adjust the value of PERCPU_DYNAMIC_EARLY_SIZE
mm/slub, percpu: correct the calculation of early percpu allocation size

Feng Tang (5):
mm/slub: only zero requested size of buffer for kzalloc when debug enabled
mm: kasan: Extend kasan_metadata_size() to also cover in-object size
mm/slub: extend redzone check to extra allocated kmalloc space than requested
mm/slub, kunit: add SLAB_SKIP_KFENCE flag for cache creation
mm/slub, kunit: Add a test case for kmalloc redzone check

Hyeonggon Yoo (1):
mm/slub: remove dead code for debug caches on deactivate_slab()

Jiri Kosina (1):
mm/slab: Annotate kmem_cache_node->list_lock as raw

Kees Cook (2):
slab: Clean up SLOB vs kmalloc() definition
slab: Remove special-casing of const 0 size allocations

Rasmus Villemoes (2):
mm: slub: remove dead and buggy code from sysfs_slab_add()
mm: slub: make slab_sysfs_init() a late_initcall

Rong Tao (1):
tools/vm/slabinfo: indicates the cause of the EACCES error

Vlastimil Babka (25):
mm/slub: perform free consistency checks before call_rcu
mm/slab: move and adjust kernel-doc for kmem_cache_alloc
mm/migrate: make isolate_movable_page() skip slab pages
mm/sl[au]b: rearrange struct slab fields to allow larger rcu_head
Merge branch 'slab/for-6.2/cleanups' into slab/for-next
Merge branch 'slab/for-6.2/locking' into slab/for-next
Merge branch 'slab/for-6.2/slub-sysfs' into slab/for-next
Merge branch 'slab/for-6.2/tools' into slab/for-next
Merge branch 'slab/for-6.2/fit_rcu_head' into slab/for-next
Merge branch 'slab/for-6.2/kmalloc_redzone' into slab/for-next
Merge branch 'slab/for-6.2/alloc_size' into slab/for-next
mm, slab: ignore hardened usercopy parameters when disabled
mm, slub: add CONFIG_SLUB_TINY
mm, slub: disable SYSFS support with CONFIG_SLUB_TINY
mm, slub: retain no free slabs on partial list with CONFIG_SLUB_TINY
mm, slub: lower the default slub_max_order with CONFIG_SLUB_TINY
mm, slub: don't create kmalloc-rcl caches with CONFIG_SLUB_TINY
mm, slab: ignore SLAB_RECLAIM_ACCOUNT with CONFIG_SLUB_TINY
mm, slub: refactor free debug processing
mm, slub: split out allocations from pre/post hooks
mm, slub: remove percpu slabs with CONFIG_SLUB_TINY
mm, slub: don't aggressively inline with CONFIG_SLUB_TINY
mm, slob: rename CONFIG_SLOB to CONFIG_SLOB_DEPRECATED
Merge branch 'slab/for-6.2/kmalloc_redzone' into slab/for-next
Merge branch 'slub-tiny-v1r6' into slab/for-next

Documentation/mm/slub.rst | 2 +
arch/arm/configs/clps711x_defconfig | 3 +-
arch/arm/configs/collie_defconfig | 3 +-
arch/arm/configs/multi_v4t_defconfig | 3 +-
arch/arm/configs/omap1_defconfig | 3 +-
arch/arm/configs/pxa_defconfig | 3 +-
arch/arm/configs/tct_hammer_defconfig | 3 +-
arch/arm/configs/xcep_defconfig | 3 +-
arch/openrisc/configs/or1ksim_defconfig | 3 +-
arch/openrisc/configs/simple_smp_defconfig | 3 +-
arch/riscv/configs/nommu_k210_defconfig | 3 +-
arch/riscv/configs/nommu_k210_sdcard_defconfig | 3 +-
arch/riscv/configs/nommu_virt_defconfig | 3 +-
arch/sh/configs/rsk7201_defconfig | 3 +-
arch/sh/configs/rsk7203_defconfig | 3 +-
arch/sh/configs/se7206_defconfig | 3 +-
arch/sh/configs/shmin_defconfig | 3 +-
arch/sh/configs/shx3_defconfig | 3 +-
include/linux/kasan.h | 5 +-
include/linux/percpu.h | 2 +-
include/linux/slab.h | 64 ++-
include/linux/slab_def.h | 2 +
include/linux/slub_def.h | 8 +-
kernel/configs/tiny.config | 5 +-
lib/Kconfig.kasan | 2 +-
lib/slub_kunit.c | 57 ++-
mm/Kconfig | 38 +-
mm/Kconfig.debug | 2 +-
mm/kasan/generic.c | 19 +-
mm/migrate.c | 15 +-
mm/slab.c | 113 +++--
mm/slab.h | 86 ++--
mm/slab_common.c | 27 +-
mm/slub.c | 553 +++++++++++++++++--------
tools/vm/slabinfo.c | 6 +-
35 files changed, 713 insertions(+), 344 deletions(-)