forked fromtorvalds/linux
- Notifications
You must be signed in to change notification settings - Fork1
Commitc52232a
timers: Forward timer base before migrating timers
On CPU hotunplug the enqueued timers of the unplugged CPU are migrated to alive CPU. This happens from the control thread which initiated the unplug.If the CPU on which the control thread runs came out from a longer idleperiod then the base clock of that CPU might be stale because the controlthread runs prior to any event which forwards the clock.In such a case the timers from the unplugged CPU are queued on the live CPUbased on the stale clock which can cause large delays due to increasedgranularity of the outer timer wheels which are far away from base:;clock.But there is a worse problem than that. The following sequence of eventsillustrates it: - CPU0 timer1 is queued expires = 59969 and base->clk = 59131. The timer is queued at wheel level 2, with resulting expiry time = 60032 (due to level granularity). - CPU1 enters idle@60007, with next timer expiry@60020. - CPU0 is hotplugged at@60009 - CPU1 exits idle and runs the control thread which migrates the timers from CPU0 timer1 is now queued in level 0 for immediate handling in the next softirq because the requested expiry time 59969 is before CPU1 base->clk 60007 - CPU1 runs code which forwards the base clock which succeeds because the next expiring timer. which was collected at idle entry time is still set to 60020. So it forwards beyond 60007 and therefore misses to expire the migrated timer1. That timer gets expired when the wheel wraps around again, which takes between 63 and 630ms depending on the HZ setting.Address both problems by invoking forward_timer_base() for the control CPUstimer base. All other places, which might run into a similar problem(mod_timer()/add_timer_on()) already invoke forward_timer_base() to avoidthat.[ tglx: Massaged comment and changelog ]Fixes:a683f39 ("timers: Forward the wheel clock whenever possible")Co-developed-by: Neeraj Upadhyay <neeraju@codeaurora.org>Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>Signed-off-by: Lingutla Chandrasekhar <clingutla@codeaurora.org>Signed-off-by: Thomas Gleixner <tglx@linutronix.de>Cc: Anna-Maria Gleixner <anna-maria@linutronix.de>Cc: linux-arm-msm@vger.kernel.orgCc: stable@vger.kernel.orgLink:https://lkml.kernel.org/r/20180118115022.6368-1-clingutla@codeaurora.org1 parenta4f5385 commitc52232a
1 file changed
+6
-0
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1894 | 1894 |
| |
1895 | 1895 |
| |
1896 | 1896 |
| |
| 1897 | + | |
| 1898 | + | |
| 1899 | + | |
| 1900 | + | |
| 1901 | + | |
| 1902 | + | |
1897 | 1903 |
| |
1898 | 1904 |
| |
1899 | 1905 |
| |
|
0 commit comments
Comments
(0)