diff options
author | Paul Walmsley <pwalmsley@nvidia.com> | 2013-03-06 19:02:56 -0800 |
---|---|---|
committer | Mrutyunjay Sawant <msawant@nvidia.com> | 2013-03-18 07:56:25 -0700 |
commit | 0c30007a7003875994df2a34067a1b4cc62be341 (patch) | |
tree | 11264f5d263acab621c4c1dbfba546c009cf4671 /kernel | |
parent | 054cea30d66b938258d3778cb9cf18026c77d714 (diff) |
sched: reinitialize rq->next_balance when a CPU is hot-added
Reinitialize rq->next_balance when a CPU is hot-added. Otherwise,
scheduler domain rebalancing may be skipped if rq->next_balance was
set to a future time when the CPU was last active, and the
newly-re-added CPU is in idle_balance(). As a result, the
newly-re-added CPU will remain idle with no tasks scheduled until the
softlockup watchdog runs - potentially 4 seconds later. This can
waste energy and reduce performance.
This behavior can be observed in some SoC kernels, which use CPU
hotplug to dynamically remove and add CPUs in response to load. In
one case that triggered this behavior,
0. the system started with all cores enabled, running multi-threaded
CPU-bound code;
1. the system entered some single-threaded code;
2. a CPU went idle and was hot-removed;
3. the system started executing a multi-threaded CPU-bound task;
4. the CPU from event 2 was re-added, to respond to the load.
The time interval between events 2 and 4 was approximately 300
milliseconds.
Of course, ideally CPU hotplug would not be used in this manner,
but this patch does appear to fix a real bug.
Nvidia folks: this patch is submitted as at least a partial fix for
bug 1243368 ("[sched] Load-balancing not happening correctly after
cores brought online")
Change-Id: Iabac21e110402bb581b7db40c42babc951d378d0
Signed-off-by: Paul Walmsley <pwalmsley@nvidia.com>
Cc: Peter Boonstoppel <pboonstoppel@nvidia.com>
Reviewed-on: http://git-master/r/206918
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Amit Kamath <akamath@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Peter Boonstoppel <pboonstoppel@nvidia.com>
Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com>
(cherry picked from commit 3a4a383487ef1d8d074a2eef608543ac1fb50675)
Reviewed-on: http://git-master/r/208936
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/sched/core.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 8319ecf82868..0d8ecc526181 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -5566,6 +5566,7 @@ migration_call(struct notifier_block *nfb, unsigned long action, void *hcpu) case CPU_UP_PREPARE: rq->calc_load_update = calc_load_update; + rq->next_balance = jiffies; break; case CPU_ONLINE: |