hotplug: add a wrapper for cpu load

Adding a wrapper function get_load() to get the
current cpu load, regardless if smart load calc
is enabled or not.

Signed-off-by: Blechd0se <alex.christ@hotmail.de>
hotplug: avoid load jumping for hotplug cpus

Imagine the following load scenario:

 CPU      0   1   2   3
 Load(%)  5   0   90  95

This happens when the scheduler decides to move processes
from the parent cpus (0,1) to the newley onlined child cpus.
In this use case, the hotplug algorithm would decide to
offline cpu 2, because its the lowest load cpu for the child
cpus.
Somehow this is a very bad thing, because first the process
was migrated to another cpu, then in the next sampling it would
be migrated back to another cpu simply because we want to offline
a cpu, which wastes time.
So this patch aims to prevent this jumping-effect by comparing
the parent and child load and stop offline operations for a
sampling, hopefully giving the scheduler the possibility to
balance the load nicely.
While this might not strike in every load scenario, it doesnt
harm in terms of battery usage.

Signed-off-by: Blechd0se <alex.christ@hotmail.de>
workqueue: Add system wide power_efficient workqueues

This patch adds system wide workqueues aligned towards power saving. This is
done by allocating them with WQ_UNBOUND flag if 'wq_power_efficient' is set to
'true'.

tj: updated comments a bit.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Tejun Heo <tj@kernel.org>
workqueues: Introduce new flag WQ_POWER_EFFICIENT for power oriented workqueues

Adapted for 3.4 from lsk-v3.10

Workqueues can be performance or power-oriented. Currently, most workqueues are
bound to the CPU they were created on. This gives good performance (due to cache
effects) at the cost of potentially waking up otherwise idle cores (Idle from
scheduler's perspective. Which may or may not be physically idle) just to
process some work. To save power, we can allow the work to be rescheduled on a
core that is already awake.

Workqueues created with the WQ_UNBOUND flag will allow some power savings.
However, we don't change the default behaviour of the system.  To enable
power-saving behaviour, a new config option CONFIG_WQ_POWER_EFFICIENT needs to
be turned on. This option can also be overridden by the
workqueue.power_efficient boot parameter.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Amit Kucheria <amit.kucheria@linaro.org>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
Signed-off-by: Blechd0se <alex.christ@hotmail.de>