diff options
author | Vlastimil Babka <vbabka@suse.cz> | 2023-11-15 00:12:47 +0300 |
---|---|---|
committer | Vlastimil Babka <vbabka@suse.cz> | 2023-12-28 21:18:18 +0300 |
commit | 782f8906f8057efc7151b4b98b0a0280a71d005f (patch) | |
tree | 2ecddbe03bf673832d2e8f7f80124a5fca09ba07 /sound | |
parent | 284f17ac13fe34ae9eecbe57bb91553374d9b855 (diff) | |
download | linux-782f8906f8057efc7151b4b98b0a0280a71d005f.tar.xz |
mm/slub: free KFENCE objects in slab_free_hook()
When freeing an object that was allocated from KFENCE, we do that in the
slowpath __slab_free(), relying on the fact that KFENCE "slab" cannot be
the cpu slab, so the fastpath has to fallback to the slowpath.
This optimization doesn't help much though, because is_kfence_address()
is checked earlier anyway during the free hook processing or detached
freelist building. Thus we can simplify the code by making the
slab_free_hook() free the KFENCE object immediately, similarly to KASAN
quarantine.
In slab_free_hook() we can place kfence_free() above init processing, as
callers have been making sure to set init to false for KFENCE objects.
This simplifies slab_free(). This places it also above kasan_slab_free()
which is ok as that skips KFENCE objects anyway.
While at it also determine the init value in slab_free_freelist_hook()
outside of the loop.
This change will also make introducing per cpu array caches easier.
Tested-by: Marco Elver <elver@google.com>
Reviewed-by: Chengming Zhou <zhouchengming@bytedance.com>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Diffstat (limited to 'sound')
0 files changed, 0 insertions, 0 deletions