mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-07 20:33:58 -04:00
hrtimer: update timer->state with 'pinned' information
'Pinned' information would be required in migrate_hrtimers() now, as we can migrate non-pinned timers away without a hotplug (i.e. with cpuset.quiesce). And so we may need to identify pinned timers now, as we can't migrate them. This patch reuses the timer->state variable for setting this flag as there were enough number of free bits available in this variable. And there is no point increasing size of this struct by adding another field. Change-Id: Id2cdd74903598e31fab6999c4cbab9c2fd17fe23 Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> [forward port to 3.18] Signed-off-by: Santosh Shukla <santosh.shukla@linaro.org> [ohaugan@codeaurora.org: Port to 4.4] Git-commit: 62feaf1ed0b64c04868d143d8bdb92d60dc3189b Git-repo: git://git.linaro.org/people/mike.holmes/santosh.shukla/lng-isol.git Signed-off-by: Olav Haugan <ohaugan@codeaurora.org> [markivx: Port to 4.14, fix merge conflicts due to lack of timer stats code] Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org> [satyap@codeaurora.org: Port to 4.19, fix merge conflicts] Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
This commit is contained in:
parent
d205b84171
commit
e2e45baa03
2 changed files with 17 additions and 5 deletions
|
|
@ -73,6 +73,7 @@ enum hrtimer_restart {
|
|||
*
|
||||
* 0x00 inactive
|
||||
* 0x01 enqueued into rbtree
|
||||
* 0x02 timer is pinned to a cpu
|
||||
*
|
||||
* The callback state is not part of the timer->state because clearing it would
|
||||
* mean touching the timer after the callback, this makes it impossible to free
|
||||
|
|
@ -92,6 +93,8 @@ enum hrtimer_restart {
|
|||
*/
|
||||
#define HRTIMER_STATE_INACTIVE 0x00
|
||||
#define HRTIMER_STATE_ENQUEUED 0x01
|
||||
#define HRTIMER_PINNED_SHIFT 1
|
||||
#define HRTIMER_STATE_PINNED (1 << HRTIMER_PINNED_SHIFT)
|
||||
|
||||
/**
|
||||
* struct hrtimer - the basic hrtimer structure
|
||||
|
|
|
|||
|
|
@ -966,7 +966,7 @@ static int enqueue_hrtimer(struct hrtimer *timer,
|
|||
|
||||
base->cpu_base->active_bases |= 1 << base->index;
|
||||
|
||||
timer->state = HRTIMER_STATE_ENQUEUED;
|
||||
timer->state |= HRTIMER_STATE_ENQUEUED;
|
||||
|
||||
return timerqueue_add(&base->active, &timer->node);
|
||||
}
|
||||
|
|
@ -986,11 +986,9 @@ static void __remove_hrtimer(struct hrtimer *timer,
|
|||
u8 newstate, int reprogram)
|
||||
{
|
||||
struct hrtimer_cpu_base *cpu_base = base->cpu_base;
|
||||
u8 state = timer->state;
|
||||
|
||||
timer->state = newstate;
|
||||
if (!(state & HRTIMER_STATE_ENQUEUED))
|
||||
return;
|
||||
if (!(timer->state & HRTIMER_STATE_ENQUEUED))
|
||||
goto out;
|
||||
|
||||
if (!timerqueue_del(&base->active, &timer->node))
|
||||
cpu_base->active_bases &= ~(1 << base->index);
|
||||
|
|
@ -1005,6 +1003,13 @@ static void __remove_hrtimer(struct hrtimer *timer,
|
|||
*/
|
||||
if (reprogram && timer == cpu_base->next_timer)
|
||||
hrtimer_force_reprogram(cpu_base, 1);
|
||||
|
||||
out:
|
||||
/*
|
||||
* We need to preserve PINNED state here, otherwise we may end up
|
||||
* migrating pinned hrtimers as well.
|
||||
*/
|
||||
timer->state = newstate | (timer->state & HRTIMER_STATE_PINNED);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -1097,6 +1102,10 @@ static int __hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim,
|
|||
/* Switch the timer base, if necessary: */
|
||||
new_base = switch_hrtimer_base(timer, base, mode & HRTIMER_MODE_PINNED);
|
||||
|
||||
/* Update pinned state */
|
||||
timer->state &= ~HRTIMER_STATE_PINNED;
|
||||
timer->state |= !!(mode & HRTIMER_MODE_PINNED) << HRTIMER_PINNED_SHIFT;
|
||||
|
||||
return enqueue_hrtimer(timer, new_base, mode);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue