Revert "kswapd: Introduce congestion_wait_kswapd"

This reverts commit dc6a7bd4926b325673a879d2418dbc41636996e2.
mm: do not sleep in balance_pgdat if there's no i/o congestion

On a 4GB RAM machine, where Normal zone is much smaller than DMA32 zone,
the Normal zone gets fragmented in time.  This requires relatively more
pressure in balance_pgdat to get the zone above the required watermark.
Unfortunately, the congestion_wait() call in there slows it down for a
completely wrong reason, expecting that there's a lot of
writeback/swapout, even when there's none (much more common).  After a
few days, when fragmentation progresses, this flawed logic translates to
a very high CPU iowait times, even though there's no I/O congestion at
all.  If THP is enabled, the problem occurs sooner, but I was able to
see it even on !THP kernels, just by giving it a bit more time to occur.

The proper way to deal with this is to not wait, unless there's
congestion.  Thanks to Mel Gorman, we already have the function that
perfectly fits the job.  The patch was tested on a machine which nicely
revealed the problem after only 1 day of uptime, and it's been working
great.

Signed-off-by: Zlatko Calusic <zlatko.calusic@iskon.hr>
Acked-by: Mel Gorman <mgorman@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
cpufreq: Add "bacon" governor

* This is nothing but polished interactive governor
  branded as "bacon" since it was adapted from bacon
  device.
* It is minimally tuned in the code. Full configuration
  is required in ramdisk for it to work properly.
* Added on mass demand.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
update version to 88u-r2
ARM: fix user unalignment prefetch abort

Branching to an address in ARM state which is not
word aligned, where this is defined to be UNPREDICTABLE,
can cause one of the following two behaviours: 1. The
unaligned location is forced to be aligned. 2. Using
the unaligned address generates a Prefetch Abort on the
first instruction using the unaligned PC value.

To be consistant for the user space binaries, the
unaligned location is forced aligned with this config.

Signed-off-by: Maria Yu <aiquny@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
update cfg
Revert "PM / sleep: Use valid_state() for platform-dependent sleep states only"

This reverts commit 06e1b4c3950b8b3bffba5476f9c1aa2dbda0dada.
Revert "PM / sleep: Add state field to pm_states[] entries"

This reverts commit 6d9f9f314a2d8b19c93dd66d4869bef2dcb251df.
Revert "PM suspend: adapt changes to EARLYSUSPEND functionality"

This reverts commit f26b0aae5d20b97834c4c0142f219dacb72192fe.
Revert "ACPI / PM: Hold ACPI scan lock over the "freeze" sleep state"

This reverts commit 9de2e49b495c7804c051f5434dd3c8e36dd141d9.
Revert "PM / suspend: Remove unnecessary !!"

This reverts commit fd15cd7c68986e4a7df088b02f74dd50de6c8eeb.
Revert "PM / sleep: invalidate TEST_CPUS and TEST_CORE support for freeze state"

This reverts commit 04967495f50cdc51b8c167312fcd3585b8fe44ab.
Revert "PM / sleep: add TEST_PLATFORM support for freeze state"

This reverts commit 6cf6e9d6c7a5a2349d63058ce48701d9fc7417b2.
Revert "PM: Introduce suspend state PM_SUSPEND_FREEZE"

This reverts commit afc18e4ba1f7b8bd6c509fab774f903b31e6c168.
Revert "power: main: Add conditional compilation for touch nodes"

This reverts commit 8c880ff58fd257d3e9f20e04704cd9d1f3371fc7.
Reverting the change is required to allow for cleaner conflict
resolution as we move to the upstream kernel's wakeup sources
based wakelock implementation.

Change-Id: Ie14fe26a0fa244815dde7845330351beeef66f99
Signed-off-by: Anurag Singh <anursing@codeaurora.org>
PM / Sleep: Look for wakeup events in later stages of device suspend

Currently, the device suspend code in drivers/base/power/main.c
only checks if there have been any wakeup events, and therefore the
ongoing system transition to a sleep state should be aborted, during
the first (i.e. "suspend") device suspend phase.  However, wakeup
events may be reported later as well, so it's reasonable to look for
them in the in the subsequent (i.e. "late suspend" and "suspend
noirq") phases.

Change-Id: Ic820926d2b8df25b987346981439b4e7cfe6795a
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
PM / Sleep: Change wakeup source statistics to follow Android

Wakeup statistics used by Android are slightly different from what we
have in wakeup sources at the moment and there aren't any known
users of those statistics other than Android, so modify them to make
it easier for Android to switch to wakeup sources.

This removes the struct wakeup_source's hit_cout field, which is very
rough and therefore not very useful, and adds two new fields,
wakeup_count and expire_count.  The first one tracks how many times
the wakeup source is activated with events_check_enabled set (which
roughly corresponds to the situations when a system power transition
to a sleep state is in progress and would be aborted by this wakeup
source if it were the only active one at that time) and the second
one is the number of times the wakeup source has been activated with
a timeout that expired.

Additionally, the last_time field is now updated when the wakeup
source is deactivated too (previously it was only updated during
the wakeup source's activation), which seems to be what Android does
with the analogous counter for wakelocks.

Change-Id: I049c27e64273b42bfb1a79528f4b5997a64390e8
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Implemented CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED + some cpuidle optimizations.
rtc: alarm: init power_on_alarm_lock mutex in alarmtimer_rtc_timer_init

Moved mutex_init of power_on_alarm_lock into alarmtimer_rtc_timer_init
so that if CONFIG_RTC_CLASS is not enabled, we dont try to initialize
the mutex.  This fixes a build issue when !CONFIG_RTC_CLASS

Change-Id: I270564b94fd54162aa177a2c9767655098662259
Signed-off-by: Kumar Gala <galak@codeaurora.org>
rtc: alarm: have dummy set_power_on_alarm function

When !CONFIG_RTC_CLASS we need to have a dummy set_power_on_alarm
function. Otherwise, it is easy to have build issues.

Change-Id: I39310241cc2e59f672964c8bc0ee4c3607aedf4e
Signed-off-by: Maria Yu <aiquny@codeaurora.org>