diff options
author | Kees Cook <keescook@chromium.org> | 2017-07-21 16:19:14 +0300 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2017-07-27 00:38:04 +0300 |
commit | c7fea48876773603721f545f8c1a2f894291ef85 (patch) | |
tree | 8aec6293f664c8240af323fd017682f64d3b5b64 /drivers/misc/lkdtm.h | |
parent | 95925c99b9043d52db626645e6ef5ee5f62c97e4 (diff) | |
download | linux-c7fea48876773603721f545f8c1a2f894291ef85.tar.xz |
lkdtm: Provide timing tests for atomic_t vs refcount_t
While not a crash test, this does provide two tight atomic_t and
refcount_t loops for performance comparisons:
cd /sys/kernel/debug/provoke-crash
perf stat -B -- cat <(echo ATOMIC_TIMING) > DIRECT
perf stat -B -- cat <(echo REFCOUNT_TIMING) > DIRECT
Looking a CPU cycles is the best way to example the fast-path (rather
than instruction counts, since conditional jumps will be executed but
will be negligible due to branch-prediction).
Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'drivers/misc/lkdtm.h')
-rw-r--r-- | drivers/misc/lkdtm.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/misc/lkdtm.h b/drivers/misc/lkdtm.h index 04ff8b23b3b0..063f5d651076 100644 --- a/drivers/misc/lkdtm.h +++ b/drivers/misc/lkdtm.h @@ -61,6 +61,8 @@ void lkdtm_REFCOUNT_INC_NOT_ZERO_SATURATED(void); void lkdtm_REFCOUNT_ADD_NOT_ZERO_SATURATED(void); void lkdtm_REFCOUNT_DEC_AND_TEST_SATURATED(void); void lkdtm_REFCOUNT_SUB_AND_TEST_SATURATED(void); +void lkdtm_REFCOUNT_TIMING(void); +void lkdtm_ATOMIC_TIMING(void); /* lkdtm_rodata.c */ void lkdtm_rodata_do_nothing(void); |