]> git.baikalelectronics.ru Git - kernel.git/commit
hrtimer: Don't take expiry_lock when timer is currently migrated
authorJulien Grall <julien.grall@arm.com>
Wed, 21 Aug 2019 09:24:09 +0000 (10:24 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Wed, 21 Aug 2019 14:10:01 +0000 (16:10 +0200)
commit088e4c0a0f006ea4e4525febcca21f4831f98337
tree7a3ed006c78c419038c960ff614300115bd7aef6
parent2e4885debb09a993545c1b42006886afdb0c8205
hrtimer: Don't take expiry_lock when timer is currently migrated

migration_base is used as a placeholder when an hrtimer is migrated to a
different CPU. In the case that hrtimer_cancel_wait_running() hits a timer
which is currently migrated it would pointlessly acquire the expiry lock of
the migration base, which is even not initialized.

Surely it could be initialized, but there is absolutely no point in
acquiring this lock because the timer is guaranteed not to run it's
callback for which the caller waits to finish on that base. So it would
just do the inc/lock/dec/unlock dance for nothing.

As the base switch is short and non-preemptible, there is no issue when the
wait function returns immediately.

The timer base and base->cpu_base cannot be NULL in the code path which is
invoking that, so just replace those checks with a check whether base is
migration base.

[ tglx: Updated from RT patch. Massaged changelog. Added comment. ]

Signed-off-by: Julien Grall <julien.grall@arm.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/20190821092409.13225-4-julien.grall@arm.com
kernel/time/hrtimer.c