freezer: shorten freezer sleep time using exponential backoff

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>

Conflicts:

	kernel/power/process.c

Change-Id: I4e2a721f9e76223c92813e472ef4f52a4f6688aa
deadline: Allow 0ms deadline latency, increase the read speed

Change a timer compare from after to after-equals, thus allowing
0 timeout and making deadline schedule FIFO.

Signed-off-by: xiaobing tu <xiaobing.tu@intel.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
[PATCH, v9] cgroups: introduce timer slack controller

Changelog:

v9:
 - update documentation
 - minor cleanup
v8:
 - change hiearchy rules
 - introduce timer_slack.effective_slack_ns
 - get_task_timer_slack() -> task_get_effective_timer_slack()
 - task_get_effective_timer_slack() splited in separate patch
 - implement PR_GET_EFFECTIVE_TIMERSLACK
v7:
 - totally reworked interface and rewritten from scratch
   (See Documentation/cgroups/timer_slack.txt for more information)
v6:
 - add documentation
 - use notifier_call_chain() instead of check hook
 - fix validate_change()
 - cleanup
v5:
 - -EBUSY on writing to timer_slack.min_slack_ns/max_slack_ns if a child has
   wider min-max range
v4:
 - hierarchy support
 - drop dummy_timer_slack_check()
 - workaround lockdep false (?) positive
 - allow 0 as timer slack value
v3:
 - rework interface
 - s/EXPORT_SYMBOL/EXPORT_SYMBOL_GPL/
v2:
 - fixed with CONFIG_CGROUP_TIMER_SLACK=y
v1:
 - initial revision

---

[PATCH, v9 1/3] hrtimer: introduce effective timer slack

task_get_effective_timer_slack() returns timer slack value to be used
to configure per-task timers. It can be equal or higher than task's
timer slack value.

For now task_get_effective_timer_slack() returns timer_slack_ns of the
task. Timer slack cgroup controller will implement a bit more
sophisticated logic.

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>

---

[PATCH, v9 2/3] hrtimer: implement PR_GET_EFFECTIVE_TIMERSLACK

PR_GET_EFFECTIVE_TIMERSLACK allows process to know its effective timer
slack value.

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>

---

[PATCH, v9 3/3] cgroups: introduce timer slack controller

Every task_struct has timer_slack_ns value. This value uses to round up
poll() and select() timeout values. This feature can be useful in
mobile environment where combined wakeups are desired.

Originally, prctl() was the only way to change timer slack value of
a process. So you was not able change timer slack value of another
process.

cgroup subsys "timer_slack" implements timer slack controller. It
provides a way to set minimal timer slack value for a group of tasks.
If a task belongs to a cgroup with minimal timer slack value higher than
task's value, cgroup's value will be applied.

Timer slack controller allows to implement setting timer slack value of
a process based on a policy. For example, you can create foreground and
background cgroups and move tasks between them based on system state.

Idea-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>

---

kernel/cgroup_timer_slack.c: fix compile error

kernel/cgroup_timer_slack.c:41: error: implicit declaration of
function 'ERR_PTR'

Signed-off-by: Boy Petersen <boypetersen@gmail.com>
Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>

Conflicts:

	include/linux/cgroup_subsys.h

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>

Conflicts:

	include/linux/cgroup_subsys.h

Change-Id: Ia2ee98cdd3e45e80cbd93026390f17c446b19cec
cgroup/timer_slack: fix cgroup permission errors

Since the common mounting of cpu and timer_slack into /dev/cpuctl
in commit
https://github.com/boype/kernel_tuna_jb42/commit/f23ab456002c2d3b416260862dbfdb82b031a450
the Android OS cannot move processes across cgoups anymore:

    W/SchedPolicy( 1180): add_tid_to_cgroup failed to write '5949'
    (Permission denied); policy=0

Fix this by implementing an 'allow_attach' handler, according to
this commit:
https://github.com/boype/kernel_tuna_jb42/commit/bb5b603036b99d80527b222dc98eba4ee8341020

Signed-off-by: Boy Petersen <boypetersen@gmail.com>
Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
config: spade: enable CGROUP_TIMER_SLACK

Change-Id: I320325ba7f321ddc80da14da0c291b58f30bd0a8
dt: add helper functions to read u32 and string property values

Add helper functions to retrieve unsigned integer and string property
values from properties of a device node. These helper functions can be
used to lookup a property in a device node, perform error checking and
read the property value.

[grant.likely@secretlab.ca: Proposal and initial implementation]
Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
[grant.likely: some word smithing and be more defensive validating the string]
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>

Conflicts:

	include/linux/of.h

Change-Id: I2efb1a77c5d5b1e43aafb846c4fd553f7d8cd525
dt: add 'const' for of_property_read_string parameter **out_string

The existing dt codes usually call of_get_property to get a string
property and save it as a 'const char *'.  The patch adds'const' for
of_property_read_string parameter **out_string to make the converting
of existing code a little easier.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
dt: add helper function to read u32 arrays

Rework of_property_read_u32 to read an array of values. Then
of_property_read_u32 becomes an inline with array size of 1.

Also make struct device_node ptr const.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>

Conflicts:

	include/linux/of.h

Change-Id: I070cafaf9c115c848d076fe6a962bccb8fe10c13
of: constify property name parameters for helper functions

The helper functions for reading u32 integers, u32 arrays and strings
should have the property name as a const pointer.

Cc: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Jamie Iles <jamie@jamieiles.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
drivers: add Contiguous Memory Allocator

The Contiguous Memory Allocator is a set of helper functions for DMA
mapping framework that improves allocations of contiguous memory chunks.

CMA grabs memory on system boot, marks it with MIGRATE_CMA migrate type
and gives back to the system. Kernel is allowed to allocate only movable
pages within CMA's managed memory so that it can be used for example for
page cache when DMA mapping do not use it. On
dma_alloc_from_contiguous() request such pages are migrated out of CMA
area to free required contiguous block and fulfill the request. This
allows to allocate large contiguous chunks of memory at any time
assuming that there is enough free memory available in the system.

This code is heavily based on earlier works by Michal Nazarewicz.

Change-Id: I8a04c58b0d39ee7343ac0b58b6dad9d57912c91d
[lauraa: fixed Kconfig conflict]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Tested-by: Rob Clark <rob.clark@linaro.org>
Tested-by: Ohad Ben-Cohen <ohad@wizery.com>
Tested-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Tested-by: Robert Nelson <robertcnelson@gmail.com>
Tested-by: Barry Song <Baohua.Song@csr.com>
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
Merge branch 'cm-11.0-wip' into cm-11.0