backport ARM tlb updates from Linux 3.10-rc5
_______________

ARM: pgtable: switch to use pgtable-nopud.h
Nick Piggin noted upon introducing 4level-fixup.h:

| Add a temporary "fallback" header so architectures can run with
| the 4level pagetables patch without modification. All architectures
| should be converted to use the folding headers (include/asm-generic/
| pgtable-nop?d.h) as soon as possible, and the fallback header removed.

This makes ARM compliant with this statement.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
_________________

ARM: LPAE: Invalidate the TLB before freeing the PMD
Similar to the PTE freeing, this patch introduced __pmd_free_tlb() which
invalidates the TLB before freeing a PMD page. This is needed because on
newer processors the entry in the upper page table may be cached by the
TLB and point to random data after the PMD has been freed.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
_________________

ARM: 7302/1: Add TLB flushing for both entries in a PMD
Linux uses two PMD entries for a PTE with the classic page table format,
covering 2MB range. However, the __pte_free_tlb() function only adds a
single TLB flush corresponding to 1MB range covering 'addr'. On
Cortex-A15, level 1 entries can be cached by the TLB independently of
the level 2 entries and without additional flushing a PMD entry would be
left pointing at the wrong PTE. The patch limits the TLB flushing range
to two 4KB pages around the 1MB boundary within PMD.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
___________________

ARM: 7503/1: mm: only flush both pmd entries for classic MMU
LPAE does not use two pmd entries for a pte, so the additional tlb
flushing is not required.

Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

Conflicts:
	arch/arm/mach-msm/pm-8x60.c
	drivers/gpu/msm/kgsl.c
sched: reinitialize rq->next_balance when a CPU is hot-added

Reinitialize rq->next_balance when a CPU is hot-added.  Otherwise,
scheduler domain rebalancing may be skipped if rq->next_balance was
set to a future time when the CPU was last active, and the
newly-re-added CPU is in idle_balance().  As a result, the
newly-re-added CPU will remain idle with no tasks scheduled until the
softlockup watchdog runs - potentially 4 seconds later.  This can
waste energy and reduce performance.

This behavior can be observed in some SoC kernels, which use CPU
hotplug to dynamically remove and add CPUs in response to load.  In
one case that triggered this behavior,

0. the system started with all cores enabled, running multi-threaded
   CPU-bound code;

1. the system entered some single-threaded code;

2. a CPU went idle and was hot-removed;

3. the system started executing a multi-threaded CPU-bound task;

4. the CPU from event 2 was re-added, to respond to the load.

The time interval between events 2 and 4 was approximately 300
milliseconds.

Of course, ideally CPU hotplug would not be used in this manner,
but this patch does appear to fix a real bug.

Nvidia folks: this patch is submitted as at least a partial fix for
bug 1243368 ("[sched] Load-balancing not happening correctly after
cores brought online")

Change-Id: Iabac21e110402bb581b7db40c42babc951d378d0
Signed-off-by: Paul Walmsley <pwalmsley@nvidia.com>
Cc: Peter Boonstoppel <pboonstoppel@nvidia.com>
Reviewed-on: http://git-master/r/208927
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Peter Zu <pzu@nvidia.com>
Reviewed-by: Peter Boonstoppel <pboonstoppel@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: Peter Zu <pzu@nvidia.com>
Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>
reverts of the day
Backport some pm functions to be ready for: Two flags for
 async suspend_noirq and suspend_late Asynchronous threads for resume_noirq
 ...
PM-sleep-Asynchronous-threads-for-resume_noirq
PM-sleep-Asynchronous-threads-for-resume_noirq
Add missing mutex_unlock() call to prevent deadlocks.
OMAP4: PRM: fix RSTTIME and RSTST offsets

RSTTIME is offset 0x8 and RSTST is offset 0x04 for OMAP4430 and
OMAP4460.

Change-Id: I6626f4f0a5b1704b755181635d47a5eb5cbf6254
Signed-off-by: Nishanth Menon <nm@ti.com>
stuff
bye uksm
mm: pksm: Import AnonPage-KSM v0.2

PKSM v0.2 by Figo.zhang with some minor changes for linux-3.4.104

Change-Id: I9c442b807c9017f979f894319511a90ac0964d14
Signed-off-by: Luis Cruz <ljc2491@gmail.com>

Conflicts:
	include/linux/page-flags.h
	mm/vmstat.c

Conflicts:
	include/linux/mm_types.h
mm: pksm: Provide support to use deferred timers for scanner thread

Based on CodeAurora's dd4c913102343a7aa8940a422ab2eacc58ada928, allowing
pksm to use deferred timers in the same manner as ksm.

Change-Id: Iecfe35eafbc957f8abde6fd69a3abd72b363d6a2
Signed-off-by: Luis Cruz <ljc2491@gmail.com>
mm: pksm: Split common ksm sysfs from pksm (for CM init)

CyanogenMod modifies ksm on init, so keep the common ksm sysfs files
in their original place.

Change-Id: I43bc7028092953ead37077931ab95270630dbe8c
Signed-off-by: Luis Cruz <ljc2491@gmail.com>
mm: pksm: Clean up warnings

Skimp out on some unused functions.

Also fix:
mm/pksm.c: In function 'is_full_zero':
mm/pksm.c:156:23: warning: initialization discards 'const' qualifier from pointer target type [enabled by default]

Change-Id: I65cf0de70aaf0708cc57e278682358cad6f5fed8
Signed-off-by: Luis Cruz <ljc2491@gmail.com>
mm: pksm: Optimize is_full_zero for ARM

Include a slightly more optimized is_full_zero, using bits from
ARM's memcmp.

Change-Id: I1403bdd13639f66284dc9a08e56a811031cd1b15
Signed-off-by: Luis Cruz <ljc2491@gmail.com>
mm: pksm: Attempt to fix null pointer dereference

Remove unneeded initializations & structure alloc_stable_anon to be
more like its non-anon counterpart in ksm.

(2 days of testing show no null pointer dereferencing)

Change-Id: Ica923048f7eb9127621b59e0b0e0d8135cd87cb9
Signed-off-by: Luis Cruz <ljc2491@gmail.com>
mm: pksm: Use hash_cmp for x86 only

Change-Id: I122aaa39e70b39c04bcd6d15f1aa82f31eda45dd
Signed-off-by: Luis Cruz <ljc2491@gmail.com>
mm: pksm: Separate pksm tuning sysfs

Allow for stock pksm values on init.
CM's tunings for ksm were sub-optimal for pksm; which
works differently.

Change-Id: Ie3688f302119630adea8cfbc86a177411c034c61
defconfig
pksm: use deffered timer by default