Skip to content

mm/slab: support kmalloc_nolock() -> kfree[_rcu]()

Harry Yoo linux-mm 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 3 repliesIn review
  2. v12 patches 3 repliesSuperseded

Changes in v2 from the cover letter

- Added Catalin's Reviewed-by tag on patch 1, and Alexei's Acked-by tag on patch 2 that I forgot to add. Thanks!

- Fix calling kfree() in free_slab_obj_exts() and alloc_slab_obj_exts() when !allow_spin. Pass allow_spin parameter down to free_slab_obj_exts().

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2mm/slab: allow freeing kmalloc_nolock()'d objects using kfree[_rcu]()include/linux/rcupdate.h mm/kmemleak.c mm/slub.c+32 -150 replies
2/2mm/slab: drop the OBJEXTS_NOSPIN_ALLOC flag from enum objext_flagsinclude/linux/memcontrol.h mm/slub.c+9 -122 replies

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchAlexei StarovoitovCatalin MarinasHao Li
1/2A-b R-b
2/2A-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v2 thread

Cover letter [PATCH V2 0/2] mm/slab: support kmalloc_nolock() -> kfree[_rcu]()

This is separated from the RFC version of "k[v]free_rcu() improvements" series [1], as these changes are relatively small and beneficial for BPF because it enables the bpf code to use kfree_rcu() instead of call_rcu() + kfree_nolock().

Patch 1 allows kfree() and kfree_rcu() to be used with objects that are allocated from kmalloc_nolock().

Patch 2 is a cleanup that frees a bit used to record whether obj_exts was allocated using kmalloc_nolock() or kmalloc(), since now both cases can be freed with kfree().

[1] https://lore.kernel.org/linux-mm/[email protected]

v1 -> v2:
- Added Catalin's Reviewed-by tag on patch 1, and Alexei's Acked-by tag on patch 2 that I forgot to add. Thanks!

- Fix calling kfree() in free_slab_obj_exts() and alloc_slab_obj_exts() when !allow_spin. Pass allow_spin parameter down to free_slab_obj_exts().

V1: https://lore.kernel.org/linux-mm/[email protected]

Harry Yoo (2):
mm/slab: allow freeing kmalloc_nolock()'d objects using kfree[_rcu]() mm/slab: drop the OBJEXTS_NOSPIN_ALLOC flag from enum objext_flags

 include/linux/memcontrol.h |  3 +--
 include/linux/rcupdate.h   |  4 ++--
 mm/kmemleak.c              | 22 ++++++++++-----------
 mm/slub.c                  | 39 +++++++++++++++++++++++++++-----------
 4 files changed, 41 insertions(+), 27 deletions(-)

base-commit: f6ed7e47c1fc78e78c9bfeb668b1ad9ba5c58120

Signature · 1 line
2.43.0