gpu: ion: Attempt heaps in the order given

A previous change (47b9888cc80b224b3d341227224c44b3c884d28a
"gpu: ion: Switch heap rbtree to a prio list") changed the
priority of the heaps to attempt higher numbers first. The
current setup of heaps assumes that lower numbers will be tried
first. Rather than break the userspace ABI once again to match
what was done previously, change the heap priority back.

Change-Id: Ibb7664e11c0b9037f6968e0766486936b3d42e16
CRs-Fixed: 502722
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
mm: add a field to store names for private anonymous memory

Userspace processes often have multiple allocators that each do
anonymous mmaps to get memory.  When examining memory usage of
individual processes or systems as a whole, it is useful to be
able to break down the various heaps that were allocated by
each layer and examine their size, RSS, and physical memory
usage.

This patch adds a user pointer to the shared union in
vm_area_struct that points to a null terminated string inside
the user process containing a name for the vma.  vmas that
point to the same address will be merged, but vmas that
point to equivalent strings at different addresses will
not be merged.

Userspace can set the name for a region of memory by calling
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, start, len, (unsigned long)name);
Setting the name to NULL clears it.

The names of named anonymous vmas are shown in /proc/pid/maps
as [anon:<name>] and in /proc/pid/smaps in a new "Name" field
that is only present for named vmas.  If the userspace pointer
is no longer valid all or part of the name will be replaced
with "<fault>".

The idea to store a userspace pointer to reduce the complexity
within mm (at the expense of the complexity of reading
/proc/pid/mem) came from Dave Hansen.  This results in no
runtime overhead in the mm subsystem other than comparing
the anon_name pointers when considering vma merging.  The pointer
is stored in a union with fieds that are only used on file-backed
mappings, so it does not increase memory usage.

Change-Id: Ie2ffc0967d4ffe7ee4c70781313c7b00cf7e3092
Signed-off-by: Colin Cross <ccross@android.com>
slub: tid must be retrieved from the percpu area of the current processor

As Steven Rostedt has pointer out: rescheduling could occur on a
different processor after the determination of the per cpu pointer and
before the tid is retrieved. This could result in allocation from the
wrong node in slab_alloc().

The effect is much more severe in slab_free() where we could free to the
freelist of the wrong page.

The window for something like that occurring is pretty small but it is
possible.

Signed-off-by: Christoph Lameter <cl@linux.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
mm: pass readahead info down to the i/o scheduler

Some i/o schedulers (i.e. row-iosched, cfq-iosched) deploy an idling
algorithm in order to be better synced with the readahead algorithm.
Idling is a prediction algorithm for incoming read requests.

In this patch we mark pages which are part of a readahead window, by
setting a newly introduced flag. With this flag, the i/o scheduler can
identify a request which is associated with a readahead page. This
enables the i/o scheduler's idling mechanism to be en-sync with the
readahead mechanism and, in turn, can increase read throughput.

Change-Id: I0654f23315b6d19d71bcc9cc029c6b281a44b196
Signed-off-by: Lee Susman <lsusman@codeaurora.org>
msm: ADSPRPC: Allow mapping of IOMMU heap buffers

Map / unmap the IOMMU heap buffers based on SMMU presence so as
to allow for these buffers to be passed to the remote processor
with zero-copy.

Change-Id: I95b3bdd46a8fa6eb3bca660a3900b5d690c12617
Acked-by: Sathish Ambley <sambley@qti.qualcomm.com>
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
msm: cpufreq: Only apply driver limits for scaling_min/max_freq writes

When new values are written to scaling_min/max_freq sysfs files, the
current code applies all the limits imposed by various ADJUST and
INCOMPATIBLE notifiers handlers before storing them.

When the ADJUST and/or INCOMPATIBLE notifiers change their limits
frequently, this behavior makes it almost impossible for a
user/userspace process to store the scaling_min/max_freq limits
that go beyond the instantaneous limits imposed by the notifiers.
Since these sysfs nodes are typically meant to set limits that need
to be enforced for the foreseeable future, this is not a very user
friendly behavior.

So, change the behavior to only apply limits that are enforced by
the cpufreq driver. Typically, these are just the absolute limits
of the HW and don't change very often.

Change-Id: I1ccfaa2d1ee4ea595f882485d359dbdb407a0176
Signed-off-by: Deepak Katragadda <dkatraga@codeaurora.org>
Revert "[media] v4l2: Introduce V4L2_QCOM_BUF_FLAG_EOS"

This reverts commit a5918b3807cc7cd9ffb5622301a28a97bc3c9d00.
Revert "msm: vidc: add 4cc for hevc hybrid decoder"

This reverts commit 18736857a65d347ba63e422a8bb0297d85b6ecf9.
Revert "msm: vidc: add hevc hybrid driver support"

This reverts commit 9c0178bedaec7b690748d974121f1dc5302d39dc.
vidc: Cleanups
msm: vidc: Set proper verbosity in EBD function logs

Driver doesn't know if the returned values by FW will cause an error.
So lower the priority of the log being printed to avoid raising false
alarms.

Change-Id: I5bccaba13b24b48f76aa70a97e380c5096507f56
Signed-off-by: Arun Menon <avmenon@codeaurora.org>
Signed-off-by: Jorge Solano Altamirano <jsolano@codeaurora.org>
msm: mdss: refactor performance calculations

Current logic could potentially lead to drop in performance (and
underflow) when multiple panels are there and both are updating mixer
configuration independently, as we may end up raising bus bandwidth for
another panel which may not be ready just yet, this is addressed by
updating performance configuration values until it's ready to switch
rather than updating values and performing these later (other panel
update could come in between).

Change-Id: Ib5077ecfd9390f67157067cb6c06106cb896868f
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
msm: mdss: account for peak bandwidth due to SMP fetch

At beginning of vsync, all pipes can start fetching at the same time in
order to fill their allocated SMP blocks, which is usually only enough
to hold first few lines of the layer. Account for this behavior and
ensure that there is enough bandwidth to fill these in the blanking
period.

Change-Id: Ic23e31813fe67958f741d52ab504ed683d23dd45
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
msm: mdss: add back bus factors for bandwidth calculations

Bus factors are needed to account for how system behaves. AB factors is
needed due to the way bus driver is calculating the bandwidth by
dividing it across 2x ports. IB factor is needed to account for DDR
inefficiency and get the correct throughput.

Change-Id: Iccf83dd25615de489d8e986c38a6d2e9175a965c
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
msm: mdss: push wait for fences and ping pong done as late as possible

All the configuration up until MDP flush is double buffered. This means
we are able to do all hardware programming without settings taking
effect until flush happens. Perform all programming, wait for fences
and wait for previous frame is done just before the flush in order to
reduce the time between last frame done and kickoff of next one.

Change-Id: I1fd0c7a65309a3b148c8efef61819bfe9a248f29
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Merge branch 'origin/v3.5'