sched/deadline: Consolidate Timer Cancellation
authorWander Lairson Costa <wander@redhat.com>
Wed, 24 Jul 2024 14:22:48 +0000 (11:22 -0300)
committerPeter Zijlstra <peterz@infradead.org>
Mon, 2 Dec 2024 11:01:31 +0000 (12:01 +0100)
commit3a181f20fb4e9ad3c93ea6c71520c23826042629
tree946953dd430a3469f0d8e32939878aee51a99944
parent53916d5fd3c0b658de3463439dd2b7ce765072cb
sched/deadline: Consolidate Timer Cancellation

After commit b58652db66c9 ("sched/deadline: Fix task_struct reference
leak"), I identified additional calls to hrtimer_try_to_cancel that
might also require a dl_server check. It remains unclear whether this
omission was intentional or accidental in those contexts.

This patch consolidates the timer cancellation logic into dedicated
functions, ensuring consistent behavior across all calls.
Additionally, it reduces code duplication and improves overall code
cleanliness.

Note the use of the __always_inline keyword. In some instances, we
have a task_struct pointer, dereference the dl member, and then use
the container_of macro to retrieve the task_struct pointer again. By
inlining the code, the compiler can potentially optimize out this
redundant round trip.

Signed-off-by: Wander Lairson Costa <wander@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Juri Lelli <juri.lelli@redhat.com>
Link: https://lore.kernel.org/r/20240724142253.27145-3-wander@redhat.com
kernel/sched/deadline.c