tmpfs: fix mempolicy object leaks

This patch fixes several mempolicy leaks in the tmpfs mount logic.
These leaks are slow - on the order of one object leaked per mount
attempt.

Leak 1 (umount doesn't free mpol allocated in mount):
    while true; do
        mount -t tmpfs -o mpol=interleave,size=100M nodev /mnt
        umount /mnt
    done

Leak 2 (errors parsing remount options will leak mpol):
    mount -t tmpfs -o size=100M nodev /mnt
    while true; do
        mount -o remount,mpol=interleave,size=x /mnt 2> /dev/null
    done
    umount /mnt

Leak 3 (multiple mpol per mount leak mpol):
    while true; do
        mount -t tmpfs -o mpol=interleave,mpol=interleave,size=100M nodev /mnt
        umount /mnt
    done

This patch fixes all of the above.  I could have broken the patch into
three pieces but is seemed easier to review as one.

Signed-off-by: Greg Thelen <gthelen@google.com>
modified for Mako kernel from LKML reference

Signed-off-by: faux123 <reioux@gmail.com>

Conflicts:
	mm/shmem.c

+ ...
+ fix build ...
+ "ARM: plat-samsung: using vsnprintf instead of vsprintf for the limit buffer length 256" - http://permalink.gmane.org/gmane.linux.kernel.samsung-soc/15490
Revert "sched: fix update NOHZ_IDLE flag"

This reverts commit 9df502dd2958b1c07af2fc194731c9949ecb3e81.
sched: Skip looking at skip if next or last is set

pick_next_entity() prefers next, then last. However code checks if the
left entity can be skipped even if next / last is set.

Check if left entity should be skipped only if next/last is not set.

Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
sync: fix timeout = 0 wait behavior

Change-Id: I8b9254e92c26d9f44abbc0c77fb44624de947013
Signed-off-by: Jamie Gennis <jgennis@google.com>
staging: android: lowmemorykiller: Don't count reserved free memory
https://www.codeaurora.org/gitweb/quic/la/?p=kernel/common.git;a=commitdiff;h=be1491accc1fec2dad8eb43a7ca6a11963cc22f8
+ "cpufreq: conservative: Fix relation when decreasing frequency" - https://patchwork.kernel.org/patch/2195551/
[need testing]
sched: Fix calc_cfs_shares() to consider blocked_load_avg also

From: Namhyung Kim <namhyung.kim@lge.com>

The calc_tg_weight() and calc_cfs_shares() used cfs_rq->load.weight
but this is no longer valid for per-entity load tracking since
cfs_rq->tg_load_contrib consists of runnable_load_avg and blocked_
load_avg.  Simply using load.weight here will lose blocked_load_avg
part so will result in an inaccurate share.

Cc: Paul Turner <pjt@google.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
+ "march armv7-a" - https://github.com/franciscofranco/mako/commit/37cd600b763611a4839a755d0a48d59e3be1ca83
+ "lib/lzo: Update LZO compression to current upstream version"
ARM: 7583/1: decompressor: Enable unaligned memory access for v6 and above

Modern GCC can generate code which makes use of the CPU's native
unaligned memory access capabilities.  This is useful for the C
decompressor implementations used for unpacking compressed kernels.

This patch disables alignment faults and enables the v6 unaligned
access model on CPUs which support these features (i.e., v6 and
later), allowing full unaligned access support for C code in the
decompressor.

The decompressor C code must not be built to assume that unaligned
access works if support for v5 or older platforms is included in
the kernel.

For correct code generation, C decompressor code must always use
the get_unaligned and put_unaligned accessors when dealing with
unaligned pointers, regardless of this patch.

Signed-off-by: Dave Martin <dave.martin@linaro.org>
Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
Enable UNALIGNED_ACCESS for the new LZO algorithm to use. LZO decrompression is used on QCACHE so we benefit a little from the new and improved LZO code.

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
Enable CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y + lower timeout in LMK
+ revert: set the static var "level" to back to the function ...
+ WIFI pwr up retry to 3 (CM default)
+ revert: "sched: Improve scalability via 'CPU buddies', which withstand random perturbations" -> http://kernel.opensuse.org/cgit/kernel/commit/?id=37407ea7f93864c2cfc03edf8f37872ec539ea2b
+ patch -p1 < patch-3.0.67-68
Restored Correct Locks/Unlocks as was.
fix nommu breakage in shmem.c

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>