Harry Yoo
c4d6d78298
mm/slab: allow freeing kmalloc_nolock()'d objects using kfree[_rcu]()
...
Slab objects that are allocated with kmalloc_nolock() must be freed
using kfree_nolock() because only a subset of alloc hooks are called,
since kmalloc_nolock() can't spin on a lock during allocation.
This imposes a limitation: such objects cannot be freed with kfree_rcu(),
forcing users to work around this limitation by calling call_rcu()
with a callback that frees the object using kfree_nolock().
Remove this limitation by teaching kmemleak to gracefully ignore cases
when kmemleak_free() or kmemleak_ignore() is called without a prior
kmemleak_alloc().
Unlike kmemleak, kfence already handles this case, because,
due to its design, only a subset of allocations are served from kfence.
With this change, kfree() and kfree_rcu() can be used to free objects
that are allocated using kmalloc_nolock().
Suggested-by: Alexei Starovoitov <ast@kernel.org >
Acked-by: Alexei Starovoitov <ast@kernel.org >
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com >
Signed-off-by: Harry Yoo <harry.yoo@oracle.com >
Link: https://patch.msgid.link/20260210044642.139482-2-harry.yoo@oracle.com
Signed-off-by: Vlastimil Babka <vbabka@suse.cz >
2026-02-10 11:39:30 +01:00
..
2025-12-23 11:23:13 -08:00
2025-12-23 11:23:12 -08:00
2025-12-05 13:52:43 -08:00
2025-11-16 17:27:54 -08:00
2025-10-20 20:22:26 +02:00
2025-08-19 16:35:57 -07:00
2025-03-16 22:06:27 -07:00
2025-07-24 19:12:36 -07:00
2025-03-16 22:06:24 -07:00
2025-09-21 14:22:06 -07:00
2025-05-22 14:55:36 -07:00
2025-09-28 11:51:29 -07:00
2025-05-12 23:50:38 -07:00
2025-11-24 15:08:54 -08:00
2025-11-20 13:43:57 -08:00
2025-07-01 13:25:36 -06:00
2025-09-28 11:51:31 -07:00
2025-10-29 15:50:42 +01:00
2025-12-05 17:01:20 -08:00
2025-03-04 17:02:25 +00:00
2025-11-16 17:27:56 -08:00
2025-09-21 14:22:15 -07:00
2025-12-05 13:52:43 -08:00
2025-12-13 20:35:41 +12:00
2025-03-17 00:05:35 -07:00
2025-09-21 14:22:11 -07:00
2025-09-21 14:22:11 -07:00
2025-11-20 13:43:57 -08:00
2025-11-20 13:43:57 -08:00
2025-11-20 13:43:57 -08:00
2025-11-16 17:28:25 -08:00
2025-03-16 22:06:29 -07:00
2025-12-09 11:25:33 -08:00
2025-09-21 14:22:21 -07:00
2025-03-16 22:06:20 -07:00
2026-01-29 09:29:27 +01:00
2025-03-16 22:06:23 -07:00
2026-01-29 09:29:26 +01:00
2025-11-29 10:41:09 -08:00
2025-11-29 10:41:08 -08:00
2026-02-10 11:39:30 +01:00
2025-12-23 11:23:17 -08:00
2025-07-09 22:41:56 -07:00
2025-07-09 22:42:22 -07:00
2025-11-29 10:41:08 -08:00
2025-12-06 14:01:20 -08:00
2025-11-16 17:27:58 -08:00
2025-12-06 14:01:20 -08:00
2025-09-21 14:22:26 -07:00
2025-03-21 22:03:11 -07:00
2026-02-04 10:05:35 +01:00
2025-11-27 14:24:41 -08:00
2025-12-03 10:45:47 -08:00
2025-12-05 13:52:43 -08:00
2025-12-23 11:23:15 -08:00
2025-11-16 17:27:52 -08:00
2025-12-05 13:52:43 -08:00
2025-12-05 17:01:20 -08:00
2025-12-03 11:53:47 -08:00
2025-12-23 11:23:16 -08:00
2025-11-24 15:08:53 -08:00
2025-11-24 15:08:54 -08:00
2025-11-24 15:08:52 -08:00
2025-11-20 13:43:58 -08:00
2025-12-07 08:56:10 -08:00
2025-11-29 10:41:11 -08:00
2025-11-24 15:08:54 -08:00
2025-11-16 17:28:25 -08:00
2025-05-12 23:50:31 -07:00
2025-09-13 16:55:07 -07:00
2025-11-24 15:08:52 -08:00
2025-11-24 15:08:54 -08:00
2025-11-20 13:43:58 -08:00
2025-09-13 16:54:46 -07:00
2025-08-20 16:31:23 +03:00
2025-08-20 16:31:23 +03:00
2025-05-12 23:50:38 -07:00
2025-11-20 13:43:59 -08:00
2026-01-29 09:29:27 +01:00
2025-03-17 00:05:35 -07:00
2025-07-13 16:38:16 -07:00
2025-11-24 15:08:48 -08:00
2025-09-21 14:22:23 -07:00
2025-07-13 16:38:29 -07:00
2025-12-23 11:23:17 -08:00
2025-11-24 15:08:51 -08:00
2025-11-24 15:08:52 -08:00
2025-12-05 13:52:43 -08:00
2025-11-24 15:08:52 -08:00
2025-09-21 14:22:04 -07:00
2025-07-13 16:38:23 -07:00
2025-11-16 17:27:54 -08:00
2025-09-08 23:45:10 -07:00
2025-11-24 15:08:48 -08:00
2025-11-16 17:28:25 -08:00
2025-11-16 17:27:52 -08:00
2025-10-20 06:30:25 -07:00
2025-11-24 15:08:54 -08:00
2025-12-05 13:52:43 -08:00
2025-12-16 19:44:36 +12:00
2025-09-21 14:22:29 -07:00
2025-03-17 00:05:40 -07:00
2026-02-10 09:10:00 +01:00
2026-02-10 09:10:00 +01:00
2026-02-10 11:39:30 +01:00
2025-11-16 17:27:56 -08:00
2025-10-14 14:24:53 +02:00
2025-03-17 22:06:58 -07:00
2025-11-24 15:08:56 -08:00
2025-09-21 14:22:25 -07:00
2025-09-21 14:22:32 -07:00
2025-11-16 17:28:20 -08:00
2025-11-29 10:41:11 -08:00
2025-12-01 10:26:38 -08:00
2025-11-13 11:01:08 +01:00
2025-11-24 15:08:54 -08:00
2025-11-16 17:28:12 -08:00
2025-11-24 15:08:54 -08:00
2025-10-02 18:18:33 -07:00
2025-11-24 15:08:54 -08:00
2025-11-20 13:43:58 -08:00
2025-12-23 11:23:11 -08:00
2025-07-24 19:12:32 -07:00
2025-12-13 20:35:41 +12:00
2025-11-20 13:43:59 -08:00
2025-12-05 13:52:43 -08:00
2025-09-21 14:21:59 -07:00
2025-09-21 14:21:59 -07:00
2025-11-16 17:27:57 -08:00