Just another stupid bln change.
Signed-off-by: scotthartbti <scott.hart.bti@gmail.com>
ARM: 6490/1: MM: bugfix: initialize spinlock for init_mm.context

init_mm used at kernel/sched.c:idle_task_exit() has spin_lock
(init_mm.context.id_lock) that is not initialized when spin_lock/unlock
is called at an ARM machine. Note that mm_struct.context.id_lock is
usually initialized except for the instance of init_mm at
linux/arch/arm/mm/context.c

Not initializing this spinlock incurs "BUG: pinlock bad magic"
warning when spinlock debug is enabled. We have observed such
instances when testing PM in S5PC210 machines.

Change-Id: I52c6c6d035c220822a5675faaf8d163a3535985d
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Colin Cross <ccross@android.com>
sched: Improve latencies under load by decreasing minimum scheduling granularity

Mathieu reported bad latencies with make -j10 kind of kbuild
workloads - which is mostly caused by us scheduling with a
too coarse granularity.

Reduce the minimum granularity some more, to make sure we
can meet the latency target.

I got the following results (make -j10 kbuild load, average of 3
runs):

 vanilla:

  maximum latency: 38278.9 Âµs
  average latency:  7730.1 Âµs

 patched:

  maximum latency: 22702.1 Âµs
  average latency:  6684.8 Âµs

Mathieu also measured it:

|
| * wakeup-latency.c (SIGEV_THREAD) with make -j10
|
| - Mainline 2.6.35.2 kernel
|
| maximum latency: 45762.1 Âµs
| average latency: 7348.6 Âµs
|
| - With only Peter's smaller min_gran (shown below):
|
| maximum latency: 29100.6 Âµs
| average latency: 6684.1 Âµs
|

Reported-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Suggested-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <AANLkTi=8m4g01wZPacySoF7U0PevTNVgJoZZrHiUD-pN@mail.gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
lib/list_sort: do not pass bad pointers to cmp callback

commit f015ac3edd84ad72f88e08a4d83c56c360aae404 upstream.

If the original list is a POT in length, the first callback from line 73
will pass a==b both pointing to the original list_head.  This is dangerous
because the 'list_sort()' user can use 'container_of()' and accesses the
"containing" object, which does not necessary exist for the list head.  So
the user can access RAM which does not belong to him.  If this is a write
access, we can end up with memory corruption.

Signed-off-by: Don Mullis <don.mullis@gmail.com>
Tested-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
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: I3b6024d5477d37245f4ebde6d7069fb77af789ee
Signed-off-by: Yuanyuan Zhong <yuanyuan.zhong@gmail.com>
ashmem: Add cache flush routines to ashmem
ashmem: Fix flush routine of ashmem

The ashmem flush function ashmem_flush_cache_range was calling
dmac_clean_range and dmac_flush_range with a user virtual address
which is not allowed. Instead of calling dmac_clean_range or
dmac_flush_range use flush_cache_user_range which can be called
with a user vitual address.

Change-Id: I5dd137fb248b45ef2c7ea5f7bdb4b540b8310af9
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
ARM: Fixes for Thumb mode. Includes:
ARM: 6191/1: Do not compile the Thumb-2 module relocations on an ARM kernel (Catalin Marinas)
ARM: Fix up vfp exception location in thumb mode (Colin Cross)
OOM rework and fixes for 2.6.35.7 (existz)
ext4: don't bump up LONG_MAX nr_to_write by a factor of 8

ext4: don't bump up LONG_MAX nr_to_write by a factor of 8

I'm uneasy with lots of stuff going on in ext4_da_writepages(),
but bumping nr_to_write from LLONG_MAX to -8 clearly isn't
making anything better, so avoid the multiplier in that case.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
ext4: stop looping in ext4_num_dirty_pages when max_pages reached

ext4: stop looping in ext4_num_dirty_pages when max_pages reached

Today we simply break out of the inner loop when we have accumulated
max_pages; this keeps scanning forwad and doing pagevec_lookup_tag()
in the while (!done) loop, this does potentially a lot of work
with no net effect.

When we have accumulated max_pages, just clean up and return.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
ext4: initialize the percpu counters before replaying the journal

We now initialize the percpu counters before replaying the journal,
but after the journal, we recalculate the global counters, to deal
with the possibility of the per-blockgroup counts getting updated by
the journal replay.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
net: Add UDP stats and pkt count to uid_stat

Change-Id: If95374a6dbde66720a3c74b5b50cc7e774bbbbf8
Signed-off-by: Ashish Sharma <ashishsharma@google.com>
staging: binder: Fix use of uninitialized variable.

Under an extremely rare condition, the variable return_error may
not be set.  This patch initializes the value to a known "bad"
value, and checks before return to ensure return_error has been
set.

Signed-off-by: Nick Kralevich <nnk@google.com>
cgroup: Set CGRP_RELEASABLE when adding to a cgroup

Changes the meaning of CGRP_RELEASABLE to be set on any cgroup
that has ever had a task or cgroup in it, or had css_get called
on it.  The bit is set in cgroup_attach_task, cgroup_create,
and __css_get.  It is not necessary to set the bit in
cgroup_fork, as the task is either in the root cgroup, in
which can never be released, or the task it was forked from
already set the bit in croup_attach_task.

Signed-off-by: Colin Cross <ccross@android.com>
cgroup: Remove call to synchronize_rcu in cgroup_attach_task

synchronize_rcu can be very expensive, averaging 100 ms in
some cases.  In cgroup_attach_task, it is used to prevent
a task->cgroups pointer dereferenced in an RCU read side
critical section from being invalidated, by delaying the
call to put_css_set until after an RCU grace period.

To avoid the call to synchronize_rcu, make the put_css_set
call rcu-safe by moving the deletion of the css_set links
into free_css_set_work, scheduled by the rcu callback
free_css_set_rcu.

The decrement of the cgroup refcount is no longer
synchronous with the call to put_css_set, which can result
in the cgroup refcount staying positive after the last call
to cgroup_attach_task returns.  To allow the cgroup to be
deleted with cgroup_rmdir synchronously after
cgroup_attach_task, have rmdir check the refcount of all
associated css_sets.  If cgroup_rmdir is called on a cgroup
for which the css_sets all have refcount zero but the
cgroup refcount is nonzero, reuse the rmdir waitqueue to
block the rmdir until free_css_set_work is called.

Signed-off-by: Colin Cross <ccross@android.com>
driver core: fix memory leak on one error path in bus_register()

Reported-by: huangweibing@gmail.com
Signed-off-by: Jike Song <albcamus@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This should work... right?
Signed-off-by: scotthartbti <scott.hart.bti@gmail.com>
Change network/wifi/ip values to match galaxy s2
Signed-off-by: scotthartbti <scott.hart.bti@gmail.com>
CONFIG_PM_OPP=y Y

Signed-off-by: scotthartbti <scott.hart.bti@gmail.com>