summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorJonas Aaberg <jonas.aberg@stericsson.com>2011-08-25 11:39:12 +0200
committerPhilippe Langlais <philippe.langlais@stericsson.com>2012-05-22 10:59:15 +0200
commit9d3966345f66144e63d13a406fd6a083c3a9a0ed (patch)
tree2574c31e76b689284ff9fa6b71d7deb68da44f03 /kernel
parent2caca6c0e2be5a574a76525feaaf2b8a7221a434 (diff)
suspend: plug/unplug non-boot cpus in threads
In order to save >100ms during resume, plugging and unplugging the secondary cpus are done in separate threads instead of in sequence with device suspend/resume calls. ST-Ericsson Linux next: Not tested, ask SSM for ER ST-Ericsson ID: ER356920 ST-Ericsson FOSS-OUT ID: Trivial Change-Id: Ie2b28595e777b056e486ae6c3d90736bb274a307 Signed-off-by: Jonas Aaberg <jonas.aberg@stericsson.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/34871 Reviewed-by: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com> Reviewed-by: Bengt JONSSON <bengt.g.jonsson@stericsson.com>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/power/suspend.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index 396d262b8fd..89ca6fa746b 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -23,6 +23,7 @@
#include <linux/slab.h>
#include <linux/export.h>
#include <linux/suspend.h>
+#include <linux/kthread.h>
#include <linux/syscore_ops.h>
#include <trace/events/power.h>
@@ -157,9 +158,10 @@ static int suspend_enter(suspend_state_t state, bool *wakeup)
if (suspend_test(TEST_PLATFORM))
goto Platform_wake;
+
error = disable_nonboot_cpus();
if (error || suspend_test(TEST_CPUS))
- goto Enable_cpus;
+ goto Platform_wake;
arch_suspend_disable_irqs();
BUG_ON(!irqs_disabled());
@@ -177,9 +179,6 @@ static int suspend_enter(suspend_state_t state, bool *wakeup)
arch_suspend_enable_irqs();
BUG_ON(irqs_disabled());
- Enable_cpus:
- enable_nonboot_cpus();
-
Platform_wake:
if (suspend_ops->wake)
suspend_ops->wake();
@@ -257,6 +256,15 @@ static void suspend_finish(void)
pm_restore_console();
}
+static int plug_secondary_cpus(void *data)
+{
+ if (!(suspend_test(TEST_FREEZER) ||
+ suspend_test(TEST_DEVICES) ||
+ suspend_test(TEST_PLATFORM)))
+ enable_nonboot_cpus();
+ return 0;
+}
+
/**
* enter_state - Do common work needed to enter system sleep state.
* @state: System sleep state to enter.
@@ -268,6 +276,7 @@ static void suspend_finish(void)
static int enter_state(suspend_state_t state)
{
int error;
+ struct task_struct *cpu_task;
if (!valid_state(state))
return -ENODEV;
@@ -296,6 +305,11 @@ static int enter_state(suspend_state_t state)
pr_debug("PM: Finishing wakeup.\n");
suspend_finish();
Unlock:
+
+ cpu_task = kthread_run(plug_secondary_cpus,
+ NULL, "cpu-plug");
+ BUG_ON(IS_ERR(cpu_task));
+
mutex_unlock(&pm_mutex);
return error;
}