diff options
| author | Marco Elver <[email protected]> | 2021-11-05 13:45:43 -0700 |
|---|---|---|
| committer | Linus Torvalds <[email protected]> | 2021-11-06 13:30:43 -0700 |
| commit | 49332956227adb35ffa7e3282c13e787325ff301 (patch) | |
| tree | 25e51e416d005cd13449689d44a09b4014d0c712 /scripts/gdb/linux/cpus.py | |
| parent | f51733e2fc4d8f01d813d71fb036d6854a53e7e3 (diff) | |
kfence: shorten critical sections of alloc/free
Initializing memory and setting/checking the canary bytes is relatively
expensive, and doing so in the meta->lock critical sections extends the
duration with preemption and interrupts disabled unnecessarily.
Any reads to meta->addr and meta->size in kfence_guarded_alloc() and
kfence_guarded_free() don't require locking meta->lock as long as the
object is removed from the freelist: only kfence_guarded_alloc() sets
meta->addr and meta->size after removing it from the freelist, which
requires a preceding kfence_guarded_free() returning it to the list or
the initial state.
Therefore move reads to meta->addr and meta->size, including expensive
memory initialization using them, out of meta->lock critical sections.
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Marco Elver <[email protected]>
Acked-by: Alexander Potapenko <[email protected]>
Cc: Dmitry Vyukov <[email protected]>
Cc: Jann Horn <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'scripts/gdb/linux/cpus.py')
0 files changed, 0 insertions, 0 deletions