Hi all, This is version two of the patches I previously posted here:
https://lkml.kernel.org/r/[email protected] Changes since v1 include: * Avoid duplicate WARNs when incrementing from zero * Some crude lktdm perf results to motivate the change: # perf stat -r 3 -B -- echo {ATOMIC,REFCOUNT}_TIMING >/sys/kernel/debug/provoke-crash/DIRECT # arm64 ATOMIC_TIMING: 46.50451 +- 0.00134 seconds time elapsed ( +- 0.00% ) REFCOUNT_TIMING (REFCOUNT_FULL, mainline): 77.57522 +- 0.00982 seconds time elapsed ( +- 0.01% ) REFCOUNT_TIMING (REFCOUNT_FULL, this series): 48.7181 +- 0.0256 seconds time elapsed ( +- 0.05% ) # x86 ATOMIC_TIMING: 31.6225 +- 0.0776 seconds time elapsed ( +- 0.25% ) REFCOUNT_TIMING (!REFCOUNT_FULL, mainline/x86 asm): 31.6689 +- 0.0901 seconds time elapsed ( +- 0.28% ) REFCOUNT_TIMING (REFCOUNT_FULL, mainline): 53.203 +- 0.138 seconds time elapsed ( +- 0.26% ) REFCOUNT_TIMING (REFCOUNT_FULL, this series): 31.7408 +- 0.0486 seconds time elapsed ( +- 0.15% ) Cheers, Will Cc: Kees Cook <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Elena Reshetova <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Ard Biesheuvel <[email protected]> Cc: Hanjun Guo <[email protected]> Cc: Jan Glauber <[email protected]> --->8 Will Deacon (6): lib/refcount: Define constants for saturation and max refcount values lib/refcount: Ensure integer operands are treated as signed lib/refcount: Remove unused refcount_*_checked() variants lib/refcount: Move bulk of REFCOUNT_FULL implementation into header lib/refcount: Improve performance of generic REFCOUNT_FULL code lib/refcount: Consolidate REFCOUNT_{MAX,SATURATED} definitions drivers/misc/lkdtm/refcount.c | 8 -- include/linux/refcount.h | 236 +++++++++++++++++++++++++++++++++++++---- lib/refcount.c | 237 +----------------------------------------- 3 files changed, 218 insertions(+), 263 deletions(-) -- 2.11.0

