lowmemorykiller compaction enhancements

Change-Id: I509022d2c415b5c474e283d62f86aaf6ac39305b
ashmem: fix deadlock when system is low on memory

When system is low on memory, allocating memory while holding the
ashmem_mutex may try to directly reclaim memory. Then ashmem_shrink()
is called in same thread. It will deadlock at acquiring ashmem_mutex.
This change lets ashmem_shrink() return failure if ashmem_mutex is not
available. Memory will be reclaimed from others.

Change-Id: Ic6439ac9877b53c006b42d007e94062b87d9bac6
mm: do not grow the stack vma just because of an overrun on
preceding vma

The stack vma is designed to grow automatically (marked with VM_GROWSUP
or VM_GROWSDOWN depending on architecture) when an access is made beyond
the existing boundary.  However, particularly if you have not limited
your stack at all ("ulimit -s unlimited"), this can cause the stack to
grow even if the access was really just one past *another* segment.

And that's wrong, especially since we first grow the segment, but then
immediately later enforce the stack guard page on the last page of the
segment.  So _despite_ first growing the stack segment as a result of
the access, the kernel will then make the access cause a SIGSEGV anyway!

So do the same logic as the guard page check does, and consider an
access to within one page of the next segment to be a bad access, rather
than growing the stack to abut the next segment.

Change-Id: I033a2f5802050b693e3422e60d7f1915d21f6c92
lib/memcopy: use glibc version

the kernel's memcpy and memmove is very inefficient. But the glibc version is
quite fast, in some cases it is 10 times faster than the kernel version. So I
introduce some memory copy macros and functions of the glibc to improve the
kernel version's performance.

The strategy of the memory functions is:
1. Copy bytes until the destination pointer is aligned.
2. Copy words in unrolled loops.  If the source and destination are not
   aligned in the same way, use word memory operations, but shift and merge
   two read words before writing.
3. Copy the few remaining bytes.

Change-Id: I82a84a951c182ef4370b33cb6786b4a5f5f3efac
lib/string: use glibc version

the performance of memcpy and memmove of the general version is very
inefficient, this patch improved them.

Change-Id: I8dc171a0326af57ed4ff77b1f7826c9ff91921f8
rwsem: squashed rwsem: steal writing sem for better performance  rwsem-spinlock: let rwsem write lock stealable

Change-Id: I6b1fa8a987cf95418f8f4f97e94159cafc5c4d9b
scatterlist: add sg_alloc_table_from_pages

Change-Id: Ic3a78ce1e6970308b46ec619b9888494e799aa13
block/deadline: tweak for better android performance

Change-Id: Ie3f9f76cbde113b7dd6bb654ae47a41376b2aa21
switch do_fsync() to fget_light()

Change-Id: I9d4eaf47a07005f1d9253eb081b0164df13284b6
ext4: prevent kernel panic in case of uninitialized jinode

Change-Id: I246a2f1863289de8c4c18ca5ca8ddd317c8132c6
kernel/resource.c: fix stack overflow in __reserve_region_with_split

Change-Id: Ieb6821e053ef8be89aace8b2464ed3ffdac6815d
sched: task_times() explosion avoidance for tasks with > 2^32 acrued ticks

Change-Id: I6543c216ccdefb7e75a1cef78c02d1e5d54397a6
sched: clock wrap bug in 2.6.35-stable kills scheduling

Change-Id: I454d8ced19b266d422d7357743e0cb29ba9cc9c5
Optimise apply_slack() for size and speed

Change-Id: I7e330491dfcfd22cf05bee234298a93c9d346e5b
sched: Kill WAKEUP_PREEMPT

Remove the WAKEUP_PREEMPT feature, disabling it doesn't make any sense
and its outlived its use by a long long while.

Change-Id: I36e5e74af9c6f5d32b92e5334c4f735a39fe962c
sched: Remove rq->avg_load_per_tas.

Change-Id: I435716b938104f32e76d54ed7cfc6c510df2b5cc
timekeeping: fix 32-bit overflow in get_monotonic_boottime

get_monotonic_boottime adds three nanonsecond values stored
in longs, followed by an s64.  If the long values are all
close to 1e9 the first three additions can overflow and
become negative when added to the s64.  Cast the first
value to s64 so that all additions are 64 bit.

Change-Id: I6834d87babaa0dfc1d89b14d997e49e4d7442532
SCHEDULER: Autogroup patch group by current user android UID instead of task ID

Change-Id: I1d1d739065931bb603d82e2874626efd8b7fe4e1
smp: no need to log this again

Change-Id: Ib8693a9868977ba197d2399efe7d5b48d5493a52
backlight: added brightness sysfs usages to log

Change-Id: I280d0a06a989ff60a4f20b3eb691f65f826e65dc