From: Kris Van Hees Date: Sat, 17 Dec 2016 23:08:44 +0000 (-0500) Subject: dtrace: fix preemption checks X-Git-Tag: v4.1.12-111.0.20170907_2225~3^2~3^2~31 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=c031f1c714bb9562e30ee12d7c0222abb46b49ea;p=users%2Fjedix%2Flinux-maple.git dtrace: fix preemption checks The macros to verify whether the current execution can be preempted were wrong. This commit fixes that. It also ensures that we call the functions (or macros) provided for enabling/disabling preemption by the kernel itself. Signed-off-by: Kris Van Hees --- diff --git a/dtrace/include/dtrace/dtrace_impl_defines.h b/dtrace/include/dtrace/dtrace_impl_defines.h index 54d5b2518a9c..443df6bffc85 100644 --- a/dtrace/include/dtrace/dtrace_impl_defines.h +++ b/dtrace/include/dtrace/dtrace_impl_defines.h @@ -184,19 +184,13 @@ typedef enum dtrace_speculation_state { #define MUTEX_HELD(lock) mutex_owned(lock) #ifdef CONFIG_PREEMPT_VOLUNTARY -# define dtrace_is_preemptive() (preempt_count() > 0) -# define dtrace_preempt_off() do { \ - preempt_count_inc(); \ - barrier(); \ - } while (0) -# define dtrace_preempt_on() do { \ - preempt_count_dec(); \ - barrier(); \ - } while (0) +# define dtrace_is_preemptive() (preempt_count() == 0) +# define dtrace_preempt_off() preempt_disable() +# define dtrace_preempt_on() preempt_enable() #endif #ifdef CONFIG_PREEMPT -# define dtrace_is_preemptive() (preempt_count() > 0) +# define dtrace_is_preemptive() (preempt_count() == 0) # define dtrace_preempt_off() preempt_disable() # define dtrace_preempt_on() preempt_enable_no_resched() #endif