diff --git a/kernel/rcu/tree_stall.h b/kernel/rcu/tree_stall.h index b10b8349bb2a..229263ebba3b 100644 --- a/kernel/rcu/tree_stall.h +++ b/kernel/rcu/tree_stall.h @@ -709,6 +709,12 @@ static void print_cpu_stall(unsigned long gps) set_preempt_need_resched(); } +#define cmpxchg_success(ptr, old, new) \ +({ \ + __typeof__(*(ptr)) __tmp = (old); \ + try_cmpxchg((ptr), &__tmp, (new)); \ +}) + static void check_cpu_stall(struct rcu_data *rdp) { bool didstall = false; @@ -760,7 +766,7 @@ static void check_cpu_stall(struct rcu_data *rdp) jn = jiffies + ULONG_MAX / 2; if (rcu_gp_in_progress() && (READ_ONCE(rnp->qsmask) & rdp->grpmask) && - cmpxchg(&rcu_state.jiffies_stall, js, jn) == js) { + cmpxchg_success(&rcu_state.jiffies_stall, js, jn)) { /* * If a virtual machine is stopped by the host it can look to @@ -778,7 +784,7 @@ static void check_cpu_stall(struct rcu_data *rdp) } else if (rcu_gp_in_progress() && ULONG_CMP_GE(j, js + RCU_STALL_RAT_DELAY) && - cmpxchg(&rcu_state.jiffies_stall, js, jn) == js) { + cmpxchg_success(&rcu_state.jiffies_stall, js, jn)) { /* * If a virtual machine is stopped by the host it can look to