block: Reserve only one queue tag for sync IO if only 3 tags are available

In case a device has three tags available we still reserve two of them
for sync IO. That leaves only a single tag for async IO such as
writeback from flusher thread which results in poor performance.

Allow async IO to consume two tags in case queue has three tag availabe
to get a decent async write performance.

This patch improves streaming write performance on a machine with such disk
from ~21 MB/s to ~52 MB/s. Also postmark throughput in presence of
streaming writer improves from 8 to 12 transactions per second so sync
IO doesn't seem to be harmed in presence of heavy async writer.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
Signed-off-by: Lens-F <tnoah12@gmail.com>
msm: hotplug: Add MSM Hotplug driver

Signed-off-by: Lens-F <tnoah12@gmail.com>

Conflicts:
	arch/arm/mach-msm/Kconfig
	arch/arm/mach-msm/Makefile
msm: hotplug: Max 1036MHz during screen off

Signed-off-by: Lens-F <tnoah12@gmail.com>
msm: hotplug: Remove spinlock in load stats

It's too expensive and not nessecary.

Signed-off-by: Lens-F <tnoah12@gmail.com>
msm: hotplug: Stop hotplug work a tad later

Signed-off-by: Lens-F <tnoah12@gmail.com>
msm: hotplug: Schedule suspend/resume work

Dennis is right, this is the proper way to suspend and resume.

Signed-off-by: Lens-F <tnoah12@gmail.com>
msm_hotplug: Remove touch boost

Signed-off-by: Lens-F <tnoah12@gmail.com>
msm: hotplug: Increase down lock duration and janitize

Signed-off-by: Lens-F <tnoah12@gmail.com>
msm: hotplug: Use high-priority workqueue

Signed-off-by: Lens-F <tnoah12@gmail.com>
msm: hotplug: Add input boost handler

Add an input handler to hotplug additional cpus. Down lock will
take care of keeping the cpu boosted.

Signed-off-by: Lens-F <tnoah12@gmail.com>
msm: hotplug: Add minimum interval for input boost

Signed-off-by: Lens-F <tnoah12@gmail.com>
msm: hotplug: Remove deprecated msm_cpufreq_set_freq_limits

Signed-off-by: Lens-F <tnoah12@gmail.com>
msm: hotplug: Cleanup hotplugging routines

Remove paroid atomic operations that were causing issues.

Signed-off-by: Lens-F <tnoah12@gmail.com>
cpufreq: add new routine cpufreq_verify_within_cpu_limits()

Most of the users of cpufreq_verify_within_limits() calls it for
limiting with min/max from policy->cpuinfo. We can make that code
simple by introducing another routine which will do this for them
automatically.

This patch adds another routine cpufreq_verify_within_cpu_limits()
and updates others to use it.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Lens-F <tnoah12@gmail.com>
msm: hotplug: Optimize hotplugging routines

- Power down the slowest cpu
- Move checks from callback to calling function
- Clean it up a bit

Signed-off-by: Lens-F <tnoah12@gmail.com>
msm: hotplug: Add pm ops

Signed-off-by: Lens-F <tnoah12@gmail.com>
msm: hotplug: Fix symbol export

Signed-off-by: Lens-F <tnoah12@gmail.com>
msm: hotplug: Fixup sysfs interface

* Use proper return values
* Fix store_down_lock_duration()
* Add some more checks
* Cleanup some mess

Signed-off-by: Lens-F <tnoah12@gmail.com>
msm: hotplug: Update threshold values and down lock duration

* Power up additional cpus earlier
* Power down cpus later
* Keep cpus online at least 5 seconds

Signed-off-by: Lens-F <tnoah12@gmail.com>
msm: hotplug: Revert to original thresholds

Signed-off-by: Lens-F <tnoah12@gmail.com>