|
@@ -991,6 +991,15 @@ int hrtimer_try_to_cancel(struct hrtimer *timer)
|
|
unsigned long flags;
|
|
unsigned long flags;
|
|
int ret = -1;
|
|
int ret = -1;
|
|
|
|
|
|
|
|
+ /*
|
|
|
|
+ * Check lockless first. If the timer is not active (neither
|
|
|
|
+ * enqueued nor running the callback, nothing to do here. The
|
|
|
|
+ * base lock does not serialize against a concurrent enqueue,
|
|
|
|
+ * so we can avoid taking it.
|
|
|
|
+ */
|
|
|
|
+ if (!hrtimer_active(timer))
|
|
|
|
+ return 0;
|
|
|
|
+
|
|
base = lock_hrtimer_base(timer, &flags);
|
|
base = lock_hrtimer_base(timer, &flags);
|
|
|
|
|
|
if (!hrtimer_callback_running(timer))
|
|
if (!hrtimer_callback_running(timer))
|