Skip to content


Subversion checkout URL

You can clone with
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: mnm9994u/aries
base: baa55d5b7d
head fork: mnm9994u/aries
compare: b1dd7993f6
Checking mergeability… Don't worry, you can still create the pull request.
This comparison is big! We're only showing the most recent 250 commits
Commits on Dec 09, 2012
stratosk aries: rfkill: fix unbalanced irq (forgot this) fb884cd
stratosk Disable incall volume settings
Too much distortion
stratosk 2.8.0 bfb252a
Commits on Dec 10, 2012
stratosk 3.0.56 8e8d81a
Commits on Dec 11, 2012
stratosk 2.8.0c e79e5fe
stratosk 2.8.0v b152d79
Commits on Dec 16, 2012
@jt1134 jt1134 ce147: fix reporting of model number
Change-Id: I0247c5bb3cf87f22630ccb65e84f14498d8bb36c

Signed-off-by: stratosk <>
Commits on Dec 17, 2012
stratosk 3.0.57 75e0d77
@jt1134 jt1134 ce147: fix derp in model number reporting patch
- oooooooooops

Change-Id: I608145d369781c9549085f2a889eeeee52fcf14f

Signed-off-by: stratosk <>
Commits on Dec 18, 2012
stratosk 2.8.3 be6b002
Commits on Dec 28, 2012
stratosk Experiment with SAI 75924c8
stratosk 2.8.4 a68cdb9
Dmitry Shmidt net: wireless: bcmdhd: Avoid suspend on watchdog
Change-Id: Ic41a8f369a2ee8b2a0084e6a1cbf6b454ff53353
Signed-off-by: Dmitry Shmidt <>
Jithu Jance net: wireless: bcmdhd: Enable P2P probe request handling only during …

Change-Id: I2db29d5ed7f66f2a45feb890c81d510fcad24dd2
Signed-off-by: Dmitry Shmidt <>
Dmitry Shmidt ipv4: Check if dev_out is NULL in ip_route_output_slow()
Change-Id: If04a8e99942dbe7e099e736dc87c2a49e1e778f9
Signed-off-by: Dmitry Shmidt <>
Dmitry Shmidt ipv4: Skip calling fib_detect_death() if fib_dev is NULL
Change-Id: I1b8c6c7e79cb8a05b4b715ddb3299d74edef0e14
Signed-off-by: Dmitry Shmidt <>
Dmitry Shmidt net: wireless: bcmdhd: Increase PNO wakelock to 7 sec
Change-Id: Ife7bac08d16e19b37d16f697e4ad9765ca6efbb7
Signed-off-by: Dmitry Shmidt <>
andy2_kuo net: wireless: bcmdhd: Prevent HT Avail timeout to frozen device whil…
…e asleep

Change-Id: I6ccd035539a3a3074b7ff1e06854ce396d784fc4
Dmitry Shmidt net: wireless: bcmdhd: Postpone taking wd_wake lock
Change-Id: I3926d7a1a357d173144f408996f35f0929db711e
Signed-off-by: Dmitry Shmidt <>
stratosk Revert: net: wireless: bcmdhd: Avoid suspend on watchdog 7ec501e
stratosk Revert "net: wireless: bcmdhd: Postpone taking wd_wake lock"
This reverts commit 3a61083.
Commits on Dec 29, 2012
stratosk Reduce number of buffers to save available RAM
thanks to DerTeufel
stratosk 2.8.5 f8491f4
stratosk Latest changes from 3.4 b3b7387
stratosk block: Adding ROW scheduling algorithm
Signed-off-by: Tatyana Brokhman <>
  - Fix bug in idling mechanism:
    -- Fix the delay passed to scedule_delayed_work
    -- Change the idle delay and idling-trigger frequency to be HZ
  - Destroy idle_workqueue on queue exit
  - Update the documentation
  - Fix bug in forced dispatch: Don't idle if forced dispatch
  No changes. Resend.
v1: Initial version
Commits on Dec 30, 2012
stratosk Make it GPL to work as module 3b762cc
stratosk 2.9.0 0b53453
stratosk SAI 9d6b914
stratosk Configs for captivate and vibrant 6c9f4e9
Commits on Jan 01, 2013
stratosk Drop BLN, implement CM LED 5ec4e18
stratosk SAI: file format a8ac6c8
Commits on Jan 03, 2013
@toddpoynor toddpoynor cpufreq: interactive: fix deadlock on spinlock in timer
Need to use irqsave/restore spinlock calls to avoid a deadlock in calls
from the timer.

Change-Id: I15b6b590045ba1447e34ca7b5ff342723e53a605
Signed-off-by: Todd Poynor <>
Commits on Jan 05, 2013
Stratos Karafotis Logger from 3.8 263fd70
Stratos Karafotis Lowmemorykiller from 3.8 2190134
Stratos Karafotis Time gpio from 3.8 b7dbf29
Commits on Jan 06, 2013
Stratos Karafotis Remove max frequency to 800MHz when screen off 040f841
Stratos Karafotis 2.9.2 df71043
stratosk This function should remain cf95474
stratosk 2.9.3 f7c49ba
Commits on Jan 07, 2013
stratosk Implement both BLN and CM led e5177c6
stratosk 2.9.4 714adda
Commits on Jan 11, 2013
stratosk 3.0.58 06582e5
Lianwei Wang cpufreq: interactive: fix race on governor start/stop
There is race condition when both two cpu do CPUFREQ_GOV_STOP and one cpu
do CPUFREQ_GOV_START soon. The sysfs_remove_group is not done yet on one
cpu, but sysfs_create_group is called on another cpu, which cause governor
start failed and then kernel panic in timer callback because the policy and
cpu mask are all kfree in cpufreq driver.

Replace atomic with mutex to lock the whole START/STOP sequence.

Change-Id: I3762b3d44315ae021b8275aca84f5ea9147cc540
Signed-off-by: Lianwei Wang <>
@toddpoynor toddpoynor 2.9.5 ceaa336
Commits on Jan 13, 2013
stratosk Some work on SAI 7bf6a9e
Commits on Jan 17, 2013
stratosk 3.0.59 cae3bd3
stratosk Use default work queue instead of a new one
Fixed the coding style and make it compliant with Linux
stratosk 2.9.7 2e2b40d
Commits on Jan 19, 2013
stratosk More work on SAI 2544874
Commits on Jan 21, 2013
stratosk 3.0.60 8579fd7
Commits on Jan 22, 2013
stratosk more experiments 0cbd6a6
stratosk 2.9.8 1461b77
Commits on Jan 23, 2013
stratosk Add tunables through sysfs 9e1ca54
Commits on Jan 28, 2013
stratosk 3.0.61 44661f5
Commits on Jan 31, 2013
stratosk drivers: android: Restructure code in lowmemorykiller
This patch restructure code for better readability and easier

Also introduces lowmemorykiller.h header file.

Signed-off-by: Stratos Karafotis <>
stratosk Inline function step_update 068ec63
stratosk Use savedefconfig to produce semaphore's defconfig 30ad973
Commits on Feb 03, 2013
stratosk Drop header file e1f6b5e
stratosk Revert: Drop header file 0ec3f0f
stratosk Revert: drivers: android: Restructure code in lowmemorykiller 8b8f16b
Commits on Feb 04, 2013
stratosk 3.0.62 8e61dff
stratosk Fix coding style issues
Also rename sampling_down_max_momentum and
sampling_down_momentum_senstivity to shorter names
stratosk Save 2 subtractions
Use pre-calculated up_threshold - down-differential as down_diff
stratosk Fix warning about show_boosttime
Remove unused function
stratosk Decrease sampling down momemtum faster
For more energy efficiency
stratosk Fix coding style 1131b4c
stratosk 2.9.9 0c66901
Commits on Feb 07, 2013
stratosk Captivate and Vibrant defconfigs aa252fb
Commits on Feb 11, 2013
stratosk 3.0.63 2a514d3
stratosk Filter input for more smooth adjustments
Also replace unsigned int tuners with shorts
stratosk 2.9.10 ab835a8
Commits on Feb 14, 2013
stratosk 3.0.64 86375e0
Commits on Feb 17, 2013
stratosk 3.0.65 83b8e51
Commits on Feb 18, 2013
stratosk 3.0.66-rc1 3fbb85f
Commits on Feb 19, 2013
stratosk Enable USB HID 656b2b9
stratosk 2.9.11 ab2560e
Commits on Feb 21, 2013
stratosk 3.0.66 a0324ad
stratosk cpufreq: ondemand: Calculate gradient of CPU load to early increase f…

Instead of checking only the absolute value of CPU load_freq to increase
frequency, we detect forthcoming CPU load rise and increase frequency

Every sampling rate, we calculate the gradient of load_freq. If it is
too steep we assume that the load most probably will go over
up_threshold in next iteration(s) and we increase frequency immediately.

New tuners are introduced:
- early_demand: to enable this functionality (disabled by default).
- grad_up_threshold: over this gradient of load we will increase
frequency immediately.

Signed-off-by: Stratos Karafotis <>
Commits on Feb 22, 2013
stratosk 2.9.12 52b2440
Commits on Feb 23, 2013
stratosk Captivate and Vibrant configs for 2.9.12 bc906f1
Commits on Feb 28, 2013
stratosk 3.0.67 5357a4a
Commits on Mar 04, 2013
stratosk turn off some debug messages cb191cc
stratosk 3.0.68

diff a/kernel/cgroup.c b/kernel/cgroup.c	(rejected hunks)
@@ -359,12 +359,20 @@ static void __put_css_set(struct css_set *cg, int
 		struct cgroup *cgrp = link->cgrp;
+		/*
+		 * We may not be holding cgroup_mutex, and if cgrp-
>count is
+		 * dropped to 0 the cgroup can be destroyed at any
time, hence
+		 * rcu_read_lock is used to keep it alive.
+		 */
+		rcu_read_lock();
 		if (atomic_dec_and_test(&cgrp->count) &&
 		    notify_on_release(cgrp)) {
 			if (taskexit)
 				set_bit(CGRP_RELEASABLE, &cgrp->flags);
+		rcu_read_unlock();

stratosk 2.9.13 9eab005
Commits on Mar 08, 2013
stratosk cpufreq: conservative: Fix sampling_down_factor

sampling_down_factor tunable is unused since commit
8e677ce (4 years ago).

This patch restores the original functionality and documents the

Signed-off-by: Stratos Karafotis <>
stratosk cpufreq: conservative: Fix the logic in frequency
decrease checking

When we evaluate the CPU load for frequency decrease we have to compare
the load against down_threshold. There is no need to subtract 10 points
from down_threshold.

Instead, we have to use the default down_threshold or user's selection

Signed-off-by: Stratos Karafotis <>
stratosk cpufreq: conservative: Use an inline function to evaluate
Use an inline function to evaluate freq_target to avoid duplicate code.

Also, define a macro for the default frequency step.

Signed-off-by: Stratos Karafotis <>
Commits on Mar 14, 2013
stratosk 3.0.69 952f2b0
stratosk 2.9.15 ebc346c
Commits on Mar 20, 2013
stratosk 3.0.70 63d3a1d
Commits on Mar 25, 2013
@br101 br101 bcmdhd: Enable Ad-Hoc (IBSS) mode
This enables Ad-Hoc (IBSS) mode for bcmdhd. We basically just need to set the
interface flag and avoid some P2P specific settings while scanning.

Also add the "station get" command for IBSS mode.

Signed-off-by: Bruno Randolf <>

Change-Id: I10a047f76495d7fedfee16d0ac10de239e494567
Signed-off-by: stratosk <>
Commits on Mar 28, 2013
stratosk Add parabolic function to update brightness 8a2ae82
stratosk 3.0.71 5b586e6
stratosk 2.9.18 583e788
Commits on Apr 06, 2013
stratosk 3.0.72 59601b0
stratosk ext4: fixup 64-bit divides in 3.0-stable backport of upstream fix
Replace C division operators with div64_u64 for divides introduced in:
commit 503f4bd
ext4: use atomic64_t for the per-flexbg free_clusters count

Specific to the 3.0-stable backport of the upstream patch.

Signed-off-by: Todd Poynor <toddpoynor@xxxxxxxxxx>
Commits on Apr 07, 2013
Arve Hjønnevåg staging: android: lowmemorykiller: Don't count reserved free memory
The amount of reserved memory varies between devices. Subtract it
here to reduce the amount of devices specific tuning needed for the
minfree values.

Cc: Android Kernel Team <>
Cc: Arve Hjønnevåg <>
Signed-off-by: Arve Hjønnevåg <>
Signed-off-by: John Stultz <>
Acked-by: David Rientjes <>
Signed-off-by: Greg Kroah-Hartman <>
Signed-off-by: stratosk <>
Arve Hjønnevåg staging: android: lowmemorykiller: Change default debug_level to 1
The kill messages are not very useful when not debugging
the lowmemorykiller itself. After the change to check TIF_MEMDIE
instead of using a task notifer this message can also get very

Cc: Android Kernel Team <>
Cc: Arve Hjønnevåg <>
Cc: Greg Kroah-Hartman <>
Signed-off-by: Arve Hjønnevåg <>
Signed-off-by: John Stultz <>
Signed-off-by: Greg Kroah-Hartman <>
Signed-off-by: stratosk <>
Dmitry Voytik staging: android: lowmemorykiller: well-marked debug print
Add "lowmemorykiller:" prefix to the debug print so it's easier to
analyse LMK's debug output:
dmesg | grep lowmemorykiller

Signed-off-by: Dmitry Voytik <>
Signed-off-by: Greg Kroah-Hartman <>
Signed-off-by: stratosk <>
Nick Kralevich staging: android: logger: Allow a UID to read it's own log entries
Modify the kernel logger to record the UID associated with
the log entries. Always allow the same UID which generated a
log message to read the log message.

Allow anyone in the logs group, or anyone with CAP_SYSLOG, to
read all log entries.

In addition, allow the client to upgrade log formats, so they
can get additional information from the kernel.

Cc: Android Kernel Team <>
Cc: Nick Kralevich <>
Signed-off-by: Nick Kralevich <>
Signed-off-by: John Stultz <>
Signed-off-by: Greg Kroah-Hartman <>
Signed-off-by: stratosk <>
Charndeep Grewal staging: android: logger: enforce GID and CAP check on log flush
Restrict log flushing to those in the logs group, or
anyone with CAP_SYSLOG.

Cc: Android Kernel Team <>
Cc: Charndeep Grewal <>
Signed-off-by: Charndeep Grewal <>
Signed-off-by: John Stultz <>
Signed-off-by: Greg Kroah-Hartman <>
Signed-off-by: stratosk <>
Kent Overstreet aio: don't include aio.h in sched.h
Faster kernel compiles by way of fewer unnecessary includes.

[ fix fallout]
Signed-off-by: Kent Overstreet <>
Cc: Zach Brown <>
Cc: Felipe Balbi <>
Cc: Greg Kroah-Hartman <>
Cc: Mark Fasheh <>
Cc: Joel Becker <>
Cc: Rusty Russell <>
Cc: Jens Axboe <>
Cc: Asai Thambi S P <>
Cc: Selvan Mani <>
Cc: Sam Bradshaw <>
Cc: Jeff Moyer <>
Cc: Al Viro <>
Cc: Benjamin LaHaise <>
Cc: Theodore Ts'o <>
Signed-off-by: Andrew Morton <>
Signed-off-by: stratosk <>
Nick Kralevich staging: android: logger: Allow a UID to read it's own log entries
Modify the kernel logger to record the UID associated with
the log entries. Always allow the same UID which generated a
log message to read the log message.

Allow anyone in the logs group, or anyone with CAP_SYSLOG, to
read all log entries.

In addition, allow the client to upgrade log formats, so they
can get additional information from the kernel.

Cc: Android Kernel Team <>
Cc: Nick Kralevich <>
Signed-off-by: Nick Kralevich <>
Signed-off-by: John Stultz <>
Signed-off-by: Greg Kroah-Hartman <>
Signed-off-by: stratosk <>
stratosk disable android_ram_console a64f803
stratosk Replace printk with pr_*
Also suppress some messages
stratosk video: samsung: Fix warning
Fix the following warning

drivers/video/samsung/s3cfb_mdnie.c: In function
drivers/video/samsung/s3cfb_mdnie.c:614:2: warning: ISO C90 forbids
mixed declarations and code [-Wdeclaration-after-statement]
stratosk Average adc value instead of normalized brightness 8a73c0c
stratosk Introduce max_br_threshold
Over this value (from light sensor) the brightness will be updated its
max value.

Thanks to Necromancer3 for this idea.
stratosk android: lowmemorykiller: Add whitelist PIDs that never been killed
Add a whitelist parameter that lets user-space specify a set of PIDs (up
to 6) that never been killed. Works in similar way like adj and minfree.

For example:
echo "PID1, PID2" > /sys/module/lowmemorykiller/parameters/w_list
Commits on Apr 08, 2013
Arve Hjønnevåg Staging: android: binder: Don't call dump_stack in binder_vma_open
If user-space partially unmaps the driver, binder_vma_open
would dump the kernel stack. This is not a kernel bug however
and will be treated as if the whole area was unmapped once
binder_vma_close gets called.

Signed-off-by: Arve Hjønnevåg <>
Cc: stable <>
Signed-off-by: Greg Kroah-Hartman <>
Signed-off-by: stratosk <>
Arve Hjønnevåg Staging: android: binder: Fix crashes when sharing a binder file betw…
…een processes

Opening the binder driver and sharing the file returned with
other processes (e.g. by calling fork) can crash the kernel.
Prevent these crashes with the following changes:
- Add a mutex to protect against two processes mmapping the
  same binder_proc.
- After locking mmap_sem, check that the vma we want to access
  (still) points to the same mm_struct.
- Use proc->tsk instead of current to get the files struct since
  this is where we get the rlimit from.

Signed-off-by: Arve Hjønnevåg <>
Cc: stable <>
Signed-off-by: Greg Kroah-Hartman <>
Signed-off-by: stratosk <>
Justin P. Mattock drivers:staging:android Typos: fix some comments that have typos in t…

Below is a patch that fixes some typos in some comments.

Signed-off-by: Justin P. Mattock <>
Cc: Randy Dunlap <>
Signed-off-by: Greg Kroah-Hartman <>
Signed-off-by: stratosk <>
David Howells Wrap accesses to the fd_sets in struct fdtable
Wrap accesses to the fd_sets in struct fdtable (for recording open files and
close-on-exec flags) so that we can move away from using fd_sets since we
abuse the fd_set structs by not allocating the full-sized structure under
normal circumstances and by non-core code looking at the internals of the

The first abuse means that use of FD_ZERO() on these fd_sets is not permitted,
since that cannot be told about their abnormal lengths.

This introduces six wrapper functions for setting, clearing and testing
close-on-exec flags and fd-is-open flags:

	void __set_close_on_exec(int fd, struct fdtable *fdt);
	void __clear_close_on_exec(int fd, struct fdtable *fdt);
	bool close_on_exec(int fd, const struct fdtable *fdt);
	void __set_open_fd(int fd, struct fdtable *fdt);
	void __clear_open_fd(int fd, struct fdtable *fdt);
	bool fd_is_open(int fd, const struct fdtable *fdt);

Note that I've prepended '__' to the names of the set/clear functions because
they require the caller to hold a lock to use them.

Note also that I haven't added wrappers for looking behind the scenes at the
the array.  Possibly that should exist too.

Signed-off-by: David Howells <>
Signed-off-by: H. Peter Anvin <>
Cc: Al Viro <>
Signed-off-by: stratosk <>
David Howells fs: Remove missed ->fds_bits from cessation use of fd_set structs int…

Stephen Rothwell reported that the following commit broke the
linux-next build:

  1fd36adcd98c: Replace the fd_sets in struct fdtable with an array of unsigned longs

Fix places where ->fds_bits needed to be removed as the core
kernel no longer uses fd_set internally for file descriptor
table management.  There are two places:

 (1) drivers/staging/android/binder.c

 (2) arch/mips/kernel/kspd.c

     Question: Should sp_cleanup() in the MIPS arch be using find_next_bit()
     or fls()?

Reported-by: Stephen Rothwell <>
Signed-off-by: David Howells <>
cc: Ralf Bächle <>
cc: Arve Hjønnevåg <>
Signed-off-by: Ingo Molnar <>
Signed-off-by: stratosk <>
@ruanzhengwang ruanzhengwang Staging:android: Change type for binder_debug_no_lock switch to bool
GCC warns that module_param_named() indirectly returns a bool type value
which is different from 'int' type binder_debug_no_lock declared. Change
it to bool because it is a internal switch for debugging.

Signed-off-by: Zhengwang Ruan <>
Signed-off-by: Greg Kroah-Hartman <>
Signed-off-by: stratosk <>
Arve Hjønnevåg Staging: android: binder: Fix use-after-free bug
binder_update_page_range could read freed memory if the vma of the
selected process was freed right before the check that the vma
belongs to the mm struct it just locked.

If the vm_mm pointer in that freed vma struct had also been rewritten
with a value that matched the locked mm struct, then the code would
proceed and possibly modify the freed vma.

Signed-off-by: Arve Hjønnevåg <>
Signed-off-by: Greg Kroah-Hartman <>
Signed-off-by: stratosk <>
Sherwin Soltani drivers: staging: android: binder.c: fix printk macros
Change printk() messages to pr_* macros.

Signed-off-by: Sherwin Soltani <>
Signed-off-by: Greg Kroah-Hartman <>
Signed-off-by: stratosk <>
Sachin Kamat Staging: android: binder: Make task_get_unused_fd_flags function static
Silence the following warning:
drivers/staging/android/binder.c:368:5: warning:
symbol 'task_get_unused_fd_flags' was not declared. Should it be static?

Cc: Arve Hjønnevåg <>
Signed-off-by: Sachin Kamat <>
Signed-off-by: Greg Kroah-Hartman <>
Signed-off-by: stratosk <>
Sachin Kamat Staging: android: binder: Remove an inconsequential conditional macro
Removes an inconsequential conditional macro.

Cc: Arve Hjønnevåg <>
Signed-off-by: Sachin Kamat <>
Signed-off-by: Greg Kroah-Hartman <>
Signed-off-by: stratosk <>
@ebiederm ebiederm userns: Add kuid_t and kgid_t and associated infrastructure in uidgid.h
Start distinguishing between internal kernel uids and gids and
values that userspace can use.  This is done by introducing two
new types: kuid_t and kgid_t.  These types and their associated
functions are infrastructure are declared in the new header

Ultimately there will be a different implementation of the mapping
functions for use with user namespaces.  But to keep it simple
we introduce the mapping functions first to separate the meat
from the mechanical code conversions.

Export overflowuid and overflowgid so we can use from_kuid_munged
and from_kgid_munged in modular code.

Acked-by: Serge Hallyn <>
Signed-off-by: Eric W. Biederman <>
Signed-off-by: stratosk <>
@ebiederm ebiederm userns: Add a Kconfig option to enforce strict kuid and kgid type checks
Make it possible to easily switch between strong mandatory
type checks and relaxed type checks so that the code can
easily be tested with the type checks and then built
with the strong type checks disabled so the resulting
code can be used.

Require strong mandatory type checks when enabling the user namespace.
It is very simple to make a typo and use the wrong type allowing
conversions to/from userspace values to be bypassed by accident,
the strong type checks prevent this.

Acked-by: Serge Hallyn <>
Signed-off-by: Eric W. Biederman <>
Signed-off-by: stratosk <>
Al Viro binder: don't allow mmap() by process other than proc->tsk
we really shouldn't do get_files_struct() on a different process
and use it to modify the sucker later on.

Signed-off-by: Al Viro <>
Signed-off-by: stratosk <>
stratosk userns: Convert binder ipc to use kuids
Cc: Arve Hjønnevåg <>
Acked-by: Greg Kroah-Hartman <>
Acked-by: Serge Hallyn <>
Signed-off-by: Eric W. Biederman <>
stratosk new helper: __alloc_fd()
Essentially, alloc_fd() in a files_struct we own a reference to.
Most of the time wanting to use it is a sign of lousy API
design (such as android/binder).  It's *not* a general-purpose
interface; better that than open-coding its guts, but again,
playing with other process' descriptor table is a sign of bad

Signed-off-by: Al Viro <>
stratosk expose a low-level variant of fd_install() for binder
Similar situation to that of __alloc_fd(); do not use unless you
really have to.  You should not touch any descriptor table other
than your own; it's a sure sign of a really bad API design.

As with __alloc_fd(), you *must* use a first-class reference to
struct files_struct; something obtained by get_files_struct(some task)
(let alone direct task->files) will not do.  It must be either
current->files, or obtained by get_files_struct(current) by the
owner of that sucker and given to you.

Signed-off-by: Al Viro <>
stratosk take descriptor-related part of close() to file.c
Signed-off-by: Al Viro <>
Arve Hjønnevåg Staging: android: binder: Add some missing binder_stat_br calls
Cached thread return errors, death notifications and new looper
requests were not included in the stats.

Signed-off-by: Arve Hjønnevåg <>
Signed-off-by: Greg Kroah-Hartman <>
Signed-off-by: stratosk <>
stratosk Staging: android: binder: Add some tracepoints
Add tracepoints:
- ioctl entry and exit
- Main binder lock: lock, locked and unlock
- Command and return buffer opcodes
- Transaction: create and receive
- Transaction buffer: create and free
- Object and file descriptor transfer
- binder_update_page_range

Signed-off-by: Arve Hjønnevåg <>
Signed-off-by: Greg Kroah-Hartman <>
Arve Hjønnevåg Staging: android: binder: Fix memory leak on thread/process exit
If a thread or process exited while a reply, one-way transaction or
death notification was pending, the struct holding the pending work
was leaked.

Signed-off-by: Arve Hjønnevåg <>
Cc: stable <>
Signed-off-by: Greg Kroah-Hartman <>
Signed-off-by: stratosk <>
Arve Hjønnevåg Staging: android: binder: Allow using highmem for binder buffers
The default kernel mapping for the pages allocated for the binder
buffers is never used. Set the __GFP_HIGHMEM flag when allocating
these pages so we don't needlessly use low memory pages that may
be required elsewhere.

Signed-off-by: Arve Hjønnevåg <>
Cc: stable <>
Signed-off-by: Greg Kroah-Hartman <>
Signed-off-by: stratosk <>
@unmole unmole Staging: android: binder: Fixed multi-line strings
Changed all user visible multi-line strings to single line.
Removed 'binder:' prefix on stings.

Signed-off-by: Anmol Sarma <>
Signed-off-by: Greg Kroah-Hartman <>
Signed-off-by: stratosk <>
@CruzBishop CruzBishop staging: android: Fix two checkpatch issues in binder.c
This fixes two instances of
"static const char * array should probably be static const char * const"

I have seen other commits doing this in other files, so I am
assuming it should be done here as well.

Please tell me if this is wrong :)

Signed-off-by: Cruz Julian Bishop <>
Signed-off-by: Greg Kroah-Hartman <>
Signed-off-by: stratosk <>
stratosk 2.9.20 b7e609c
Commits on Apr 09, 2013
stratosk captivate and vibrant defconfigs 83479d4
Commits on Apr 10, 2013
stratosk Enable again RAM_CONSOLE
It caused bootloops to some devices (specially in captivate and vibrant)
@dvdhrm dvdhrm HID: uhid: introduce user-space I/O driver support for HID
This adds a dummy driver that will support user-space I/O drivers for the
HID subsystem. This allows to write transport-level drivers like USB-HID
and Bluetooth-HID in user-space.

Low-Energy Bluetooth needs this to feed HID data that is parsed in
user-space back into the kernel.

Signed-off-by: David Herrmann <>
Signed-off-by: Jiri Kosina <>
@dvdhrm dvdhrm HID: uhid: add internal message buffer
When receiving messages from the HID subsystem, we need to process them
and store them in an internal buffer so user-space can read() on the char
device to retrieve the messages.

This adds a static buffer for 32 messages to each uhid device. Each
message is dynamically allocated so the uhid_device structure does not get
too big.

uhid_queue() adds a message to the buffer. If the buffer is full, the
message is discarded. uhid_queue_event() is an helper for messages without

This also adds a public header: uhid.h. It contains the declarations for
the user-space API. It is built around "struct uhid_event" which contains
a type field which specifies the event type and each event can then add a
variable-length payload. For now, there is only a dummy event but later
patches will add new event types and payloads.

Signed-off-by: David Herrmann <>
Signed-off-by: Jiri Kosina <>
@dvdhrm dvdhrm HID: uhid: allow poll()'ing on uhid devices
As long as the internal buffer is not empty, we return POLLIN to

uhid->head and uhid->tail are no atomics so the comparison may return
inexact results. However, this doesn't matter here as user-space would
need to poll() in two threads simultaneously to trigger this. And in this
case it doesn't matter if a cached result is returned or the exact new
result as user-space does not know which thread returns first from poll()
and the following read(). So it is safe to compare the values without

Signed-off-by: David Herrmann <>
Signed-off-by: Jiri Kosina <>
@dvdhrm dvdhrm HID: uhid: implement read() on uhid devices
User-space can use read() to get a single event from uhid devices. read()
does never return multiple events. This allows us to extend the event
structure and still keep backwards compatibility.

If user-space wants to get multiple events in one syscall, they should use
the readv()/writev() syscalls which are supported by uhid.

This introduces a new lock which helps us synchronizing simultaneous reads
from user-space. We also correctly return -EINVAL/-EFAULT only on errors
and retry the read() when some other thread captured the event faster than
we did.

Signed-off-by: David Herrmann <>
Signed-off-by: Jiri Kosina <>
@dvdhrm dvdhrm HID: uhid: implement write() on uhid devices
Similar to read() you can only write() a single event with one call to an
uhid device. To write multiple events use writev() which is supported by

We currently always return -EOPNOTSUPP but other events will be added in
later patches.

Signed-off-by: David Herrmann <>
Signed-off-by: Jiri Kosina <>
@dvdhrm dvdhrm HID: uhid: add UHID_CREATE and UHID_DESTROY events
UHID_CREATE and UHID_DESTROY are used to create and destroy a device on an
open uhid char-device. Internally, we allocate and register an HID device
with the HID core and immediately start the device. From now on events may
be received or sent to the device.

The UHID_CREATE event has a payload similar to the data used by
Bluetooth-HIDP when creating a new connection.

Signed-off-by: David Herrmann <>
Signed-off-by: Jiri Kosina <>
@dvdhrm dvdhrm HID: uhid: allow feeding input data into uhid devices
This adds a new event type UHID_INPUT which allows user-space to feed raw
HID reports into the HID subsystem. We copy the data into kernel memory
and directly feed it into the HID core.

There is no error handling of the events couldn't be parsed so user-space
should consider all events successfull unless read() returns an error.

Signed-off-by: David Herrmann <>
Signed-off-by: Jiri Kosina <>
@dvdhrm dvdhrm HID: uhid: forward hid report-descriptor to hid core
When the uhid_hid_parse callback is called we simply forward it to
hid_parse_report() with the data that we got in the UHID_CREATE event.

Signed-off-by: David Herrmann <>
Signed-off-by: Jiri Kosina <>
@dvdhrm dvdhrm HID: uhid: add UHID_START and UHID_STOP events
We send UHID_START and UHID_STOP events to user-space when the HID core
starts/stops the device. This notifies user-space about driver readiness
and data-I/O can start now.

This directly forwards the callbacks from hid-core to user-space.

Signed-off-by: David Herrmann <>
Signed-off-by: Jiri Kosina <>
@dvdhrm dvdhrm HID: uhid: forward open/close events to user-space
HID core notifies us with *_open/*_close callbacks when there is an actual
user of our device. We forward these to user-space so they can react on
this. This allows user-space to skip I/O unless they receive an OPEN
event. When they receive a CLOSE event they can stop I/O again to save

Signed-off-by: David Herrmann <>
Signed-off-by: Jiri Kosina <>
@dvdhrm dvdhrm HID: uhid: forward output request to user-space
If the hid-driver wants to send standardized data to the device it uses a
linux input_event. We forward this to the user-space transport-level
driver so they can perform the requested action on the device.

Signed-off-by: David Herrmann <>
Signed-off-by: Jiri Kosina <>
@dvdhrm dvdhrm HID: uhid: forward raw output reports to user-space
Some drivers that use non-standard HID features require raw output reports
sent to the device. We now forward these requests directly to user-space
so the transport-level driver can correctly send it to the device or
handle it correspondingly.

There is no way to signal back whether the transmission was successful,
moreover, there might be lots of messages coming out from the driver
flushing the output-queue. However, there is currently no driver that
causes this so we are safe. If some drivers need to transmit lots of data
this way, we need a method to synchronize this and can implement another

Signed-off-by: David Herrmann <>
Signed-off-by: Jiri Kosina <>
@dvdhrm dvdhrm HID: uhid: implement feature requests
HID standard allows sending a feature request to the device which is
answered by an HID report. uhid implements this by sending a UHID_FEATURE
event to user-space which then must answer with UHID_FEATURE_ANSWER. If it
doesn't do this in a timely manner, the request is discarded silently.

We serialize the feature requests, that is, there is always only a single
active feature-request sent to user-space, other requests have to wait.
HIDP and USB-HID do it the same way.

Because we discard feature-requests silently, we must make sure to match
a response to the corresponding request. We use sequence-IDs for this so
user-space must copy the ID from the request into the answer.
Feature-answers are ignored if they do not contain the same ID as the
currently pending feature request.

Internally, we must make sure that feature-requests are synchronized with
UHID_DESTROY and close() events. We must not dead-lock when closing the
HID device, either, so we have to use separate locks.

Signed-off-by: David Herrmann <>
Signed-off-by: Jiri Kosina <>
@dvdhrm dvdhrm HID: uhid: add documentation
This describes the protocol used by uhid for user-space applications. It
describes the details like non-blocking I/O and readv/writev for multiple
events per syscall.

Signed-off-by: David Herrmann <>
Signed-off-by: Jiri Kosina <>
@dvdhrm dvdhrm HID: uhid: add example program
This adds an example user-space program that emulates a 3 button mouse
with wheel. It detects keyboard presses and moves the mouse accordingly.

It register a fake HID device to feed the raw HID reports into the kernel.
In this example, you could use uinput to get the same result, but this
shows how to get the same behavior with uhid so you don't need HID parsers
in user-space.

Signed-off-by: David Herrmann <>
Signed-off-by: Jiri Kosina <>
Jiri Kosina HID: uhid: silence gcc warning
gcc is giving me:

drivers/hid/uhid.c: In function ‘uhid_hid_get_raw’:
drivers/hid/uhid.c:157: warning: ‘len’ may be used uninitialized in this function

which is clearly bogus, as

- when used as memcpy() argument, it's initialized properly
- the code is structured in a way that either 'ret' or 'len'
  is always initialized, so the return statement always has
  an initialized value.

Signed-off-by: Jiri Kosina <>
Vinicius Costa Gomes HID: uhid: Fix sending events with invalid data
This was detected because events with invalid types were arriving
to userspace.

The code before this patch would only work for the first event in the
queue (when uhid->tail is 0).

Signed-off-by: Vinicius Costa Gomes <>
Reviewed-by: David Herrmann <>
Signed-off-by: Jiri Kosina <>
@shayneholmes shayneholmes config: Enable UHID 9083a55
stratosk 2.9.21 d8199d2
Commits on Apr 12, 2013
stratosk 3.0.73 78419d6
stratosk Merge branch 'jb-4.2.1-with-uhid' of…
…samsung-kernel-aries into jb-4.2.1

Thanks to n8r for implementing it to Semaphore.
Commits on Apr 19, 2013
stratosk 3.0.74 9a2550f
stratosk 2.9.22 aa4b96c
Commits on Apr 26, 2013
stratosk 3.0.75 a17a875
stratosk build UHID as module 11f6acd
stratosk 2.9.23 7d268d2
Commits on May 01, 2013
stratosk 3.0.76
Signed-off-by: Stratos Karafotis <>
Stratos Karafotis sema_autobr: Change max_lux input to 4000 9e7a8ea
Stratos Karafotis 2.9.24
Signed-off-by: Stratos Karafotis <>
Commits on May 03, 2013
Stratos Karafotis sema_autobr: Fix typo
Signed-off-by: Stratos Karafotis <>
Commits on May 08, 2013
Stratos Karafotis 3.0.77
Signed-off-by: Stratos Karafotis <>
Commits on May 09, 2013
Stratos Karafotis sema_autobr: max_br_threshold can be 0
Signed-off-by: Stratos Karafotis <>
Commits on May 12, 2013
Stratos Karafotis 3.0.78 0972b8c
Stratos Karafotis sema_autobr: Permit greater values for more slower updates
Signed-off-by: Stratos Karafotis <>
Commits on May 13, 2013
Stratos Karafotis Revert "Disable incall volume settings"
This reverts commit 313ada4.
Stratos Karafotis 2.9.25
Signed-off-by: Stratos Karafotis <>
Commits on May 19, 2013
Stratos Karafotis 3.0.79
Signed-off-by: Stratos Karafotis <>
Commits on May 25, 2013
Stratos Karafotis 3.0.80
Signed-off-by: Stratos Karafotis <>
Commits on Jun 02, 2013
Stratos Karafotis cpufreq: ondemand: Change the calculation of target frequency
Signed-off-by: Stratos Karafotis <>
Stratos Karafotis 2.9.26
Signed-off-by: Stratos Karafotis <>
Commits on Jun 18, 2013
Stratos Karafotis 3.0.81
Signed-off-by: Stratos Karafotis <>
Stratos Karafotis 3.0.82
Signed-off-by: Stratos Karafotis <>
Commits on Jun 23, 2013
Stratos Karafotis 3.0.83
Signed-off-by: Stratos Karafotis <>
Commits on Jun 26, 2013
Stratos Karafotis cpufreq: ondemand: Drop early_demand
Since we changed the calculation of target frequency early demand is
kind of useless.

Signed-off-by: Stratos Karafotis <>
Commits on Jun 29, 2013
Stratos Karafotis 3.0.84
Signed-off-by: Stratos Karafotis <>
Dmitry Shmidt net: wireless: bcmdhd: Update to version
- Fix p2p support for new wpa_supplicant
- Propagate disconnect error code for cfg80211

Change-Id: I9643fbad7b6170b0e794fd7854201931d5eefb22
Signed-off-by: Dmitry Shmidt <>

@ajs1984 ajs1984 gpu: pvr: Update to DDK 1.8@2198402
- Implemented a DC API change which queues a dummy display flip to
   workaround a rare and difficult to reproduce synchronization
 - Eliminate log spam from Linux shrinker integration.

@imoseyon imoseyon gpu: pvr: bypass compat check if version is same but build # is diffe…

Signed-off-by: Stratos Karafotis <>
Stratos Karafotis 3.0.0
Signed-off-by: Stratos Karafotis <>
Commits on Aug 04, 2013
Stratos Karafotis 3.0.85
Signed-off-by: Stratos Karafotis <>
Stratos Karafotis 3.0.86
Signed-off-by: Stratos Karafotis <>
Stratos Karafotis 3.0.87
Signed-off-by: Stratos Karafotis <>
Stratos Karafotis 3.0.88 b9715ea
Stratos Karafotis 3.0.89
Signed-off-by: Stratos Karafotis <>
Commits on Aug 11, 2013
@stephensmalley stephensmalley yaffs: fix getxattr support
When passed a buffer size of 0, getxattr(2) is documented to return the
size of the attribute value.  However, yaffs returns -ERANGE instead.
This breaks SELinux usage of getxattr.  Fix yaffs to return the
attribute size in this case.

Change-Id: I410e96ad36741b8fd6aef70d0aabc22391c8d5ac
Signed-off-by:  Stephen Smalley <>
@stephensmalley stephensmalley yaffs: set security attribute at file creation
Add support to yaffs to set the security attribute of new inodes when
they are created.  This parallels similar support in other filesystems,
and is a requirement for SELinux and other MAC systems.

Change-Id: I46ffb4f6aabebfa7bd66a502b6d890998b0da08c
Signed-off-by:  Stephen Smalley <>
@stephensmalley stephensmalley Do not ratelimit audit messages. We want to see them all.
Change-Id: I19c29788cc33b0f59e0bdfe04fe67c247239c559
@stephensmalley stephensmalley Add permission checking for binder IPC.
Change-Id: Ia224e29427d39a6eeb0800a65ad2a8df2e91bebc

Stratos Karafotis Revert "Add permission checking for binder IPC."
This reverts commit 7040be4.
JP Abgrall netfilter: xt_qtaguid: remove AID_* dependency for access control
qtaguid limits what can be done with /ctrl and /stats based on group
This changes removes AID_NET_BW_STATS and AID_NET_BW_ACCT, and picks
up the groups from the gid of the matching proc entry files.

Signed-off-by: JP Abgrall <>
Change-Id: I42e477adde78a12ed5eb58fbc0b277cdaadb6f94
JP Abgrall netfilter: xt_qtaguid: extend iface stat to report protocols
In the past the iface_stat_fmt would only show global bytes/packets
for the skb-based numbers.
For stall detection in userspace, distinguishing tcp vs other protocols
makes it easier.
Now we report
  ifname total_skb_rx_bytes total_skb_rx_packets total_skb_tx_bytes
  total_skb_tx_packets {rx,tx}_{tcp,udp,ohter}_{bytes,packets}

Bug: 6818637
Signed-off-by: JP Abgrall <>
JP Abgrall netfilter: xt_qtaguid: Allow tracking loopback
In the past it would always ignore interfaces with loopback addresses.
Now we just treat them like any other.
This also helps with writing tests that check for the presence
of the qtaguid module.

Signed-off-by: JP Abgrall <>
JP Abgrall netfilter: qtaguid: rate limit some of the printks
Some of the printks are in the packet handling path.
We now ratelimit the very unlikely errors to avoid
kmsg spamming.

Signed-off-by: JP Abgrall <>
Stratos Karafotis config: Support for SELinux
Thanks to CM

Signed-off-by: Stratos Karafotis <>
@stephensmalley stephensmalley Add permission checking for binder IPC.
Signed-off-by: Stratos Karafotis <>
@stephensmalley stephensmalley Do not apply permission checks to private files.
Change-Id: I472d9630de5113667c289dce7e4fdc8eace04e36
@stephensmalley stephensmalley Fix security_binder_transfer_binder hook.
Drop the owning task argument to security_binder_transfer_binder
since ref->node->proc can be NULL (dead owner?).
Revise the SELinux checking to apply a single transfer check between
the source and destination tasks.  Owning task is no longer relevant.
Drop the receive permission definition as it is no longer used.

This makes the transfer permission similar to the call permission; it is only
useful if you want to allow a binder IPC between two tasks (call permission)
but deny passing of binder references between them (transfer permission).

Change-Id: I6ec460ede8e07dadc9f52b61534b2b0021617302
Commits on Aug 13, 2013
Stratos Karafotis 3.0.90
Signed-off-by: Stratos Karafotis <>
Commits on Aug 16, 2013
Stratos Karafotis config: Enable more options for SELinux
Signed-off-by: Stratos Karafotis <>
Stratos Karafotis 3.0.91
Signed-off-by: Stratos Karafotis <>
Stratos Karafotis config: Disable SELinux
Signed-off-by: Stratos Karafotis <>
Stratos Karafotis 3.1.0
Signed-off-by: Stratos Karafotis <>
Commits on Aug 23, 2013
@PRJosh PRJosh More options for SELinux on captivate
Change-Id: I0abfc59b1e0bb109301f45f6682b2f406b200468
Signed-off-by: Josue Rivera <>
@PRJosh PRJosh Revert "config: Disable SELinux"
This reverts commit 4bb3526.
Commits on Sep 21, 2013
Stratos Karafotis 3.0.92
Signed-off-by: Stratos Karafotis <>
Stratos Karafotis 3.0.93
Signed-off-by: Stratos Karafotis <>
Stratos Karafotis 3.0.94
Signed-off-by: Stratos Karafotis <>
Stratos Karafotis 3.0.95
Signed-off-by: Stratos Karafotis <>
Stratos Karafotis 3.0.96
Signed-off-by: Stratos Karafotis <>
Commits on Sep 27, 2013
@PRJosh PRJosh More SELinux options on vibrant
Change-Id: Iade8aa0d3977c53618838690ad1fba14ada62fa7
Signed-off-by: Josue Rivera <>
Stratos Karafotis 3.0.97
Signed-off-by: Stratos Karafotis <>
Stratos Karafotis 3.2.0
Signed-off-by: Stratos Karafotis <>
@PRJosh PRJosh Merge remote-tracking branch 'stratos/jb-4.3' into jb-4.3 ba4f22d
@PRJosh PRJosh Updated defconfigs
Change-Id: I33071c454a1f5a5a1216038c1aa8635323f76ba7
Signed-off-by: Josue Rivera <>
Commits on Oct 27, 2013
Stratos Karafotis config: Captivate and Vibrant updates
Signed-off-by: Stratos Karafotis <>
Stratos Karafotis 3.0.98
Signed-off-by: Stratos Karafotis <>
Stratos Karafotis 3.0.99
Signed-off-by: Stratos Karafotis <>
Stratos Karafotis 3.0.100
Signed-off-by: Stratos Karafotis <>
Stratos Karafotis 3.0.101
Signed-off-by: Stratos Karafotis <>
Stratos Karafotis 3.3.0
Signed-off-by: Stratos Karafotis <>
@PRJosh PRJosh Merge remote-tracking branch 'stratos/jb-4.3' into HEAD

Change-Id: I9e9fe777bf3bd0b43df739c79e795f586993e5e5
Commits on Dec 04, 2013
Stratos Karafotis config: Enable SELinux
Signed-off-by: Stratos Karafotis <>
Stratos Karafotis config: compile FUSE built-in
Signed-off-by: Stratos Karafotis <>
Commits on Dec 06, 2013
Stratos Karafotis 3.4.0
Signed-off-by: Stratos Karafotis <>
@PRJosh PRJosh Merge remote-tracking branch 'stratos/kk-4.4' into HEAD 90ea39e
Commits on Dec 14, 2013
@PRJosh PRJosh Update defconfig to include fuse
Change-Id: I6796001a92e82f16799746185055bfebf6653629
Signed-off-by: Josue Rivera <>
Commits on Jan 19, 2014
@pawitp pawitp S5PC11X: JPEG: add ioctl to export memory configuration
This allows userspace libs3cjpeg to read memory configuration
from the kernel instead of using the hardcoded value.

Change-Id: I61248d659dbccf2e6cc656adc7fdf18773c2fcbd
@pawitp pawitp aries: optimize JPEG memory configuration
Only 1MB is required for encoding of VGA JPEG images (used by FFC).
Note that thumbnail encoding function is not used.

Change-Id: Icea2fc74dfc692d98ae041b785238d6b847c4ddd
@mnm9994u Fix Buffers Count
Change-Id: Ie91979fb12fe38b3287634213dc3661a4651d502
@longman88 longman88 mutex: Make more scalable by doing less atomic operations
Date	Thu, 4 Apr 2013 10:54:16 -0400

In the __mutex_lock_common() function, an initial entry into
the lock slow path will cause two atomic_xchg instructions to be
issued. Together with the atomic decrement in the fast path, a total
of three atomic read-modify-write instructions will be issued in
rapid succession. This can cause a lot of cache bouncing when many
tasks are trying to acquire the mutex at the same time.

This patch will reduce the number of atomic_xchg instructions used by
checking the counter value first before issuing the instruction. The
atomic_read() function is just a simple memory read. The atomic_xchg()
function, on the other hand, can be up to 2 order of magnitude or even
more in cost when compared with atomic_read(). By using atomic_read()
to check the value first before calling atomic_xchg(), we can avoid a
lot of unnecessary cache coherency traffic. The only downside with this
change is that a task on the slow path will have a tiny bit
less chance of getting the mutex when competing with another task
in the fast path.

The same is true for the atomic_cmpxchg() function in the
mutex-spin-on-owner loop. So an atomic_read() is also performed before
calling atomic_cmpxchg().

The mutex locking and unlocking code for the x86 architecture can allow
any negative number to be used in the mutex count to indicate that some
tasks are waiting for the mutex. I am not so sure if that is the case
for the other architectures. So the default is to avoid atomic_xchg()
if the count has already been set to -1. For x86, the check is modified
to include all negative numbers to cover a larger case.

The following table shows the scalability data on an 8-node 80-core
Westmere box with a 3.7.10 kernel. The numactl command is used to
restrict the running of the high_systime workloads to 1/2/4/8 nodes
with hyperthreading on and off.

|  Configuration  | Mean Transaction | Mean Transaction | % Change |
|		  |  Rate w/o patch  | Rate with patch  |	   |
|		  |              User Range 1100 - 2000		   |
| 8 nodes, HT on  |      36980       |      148590      | +301.8%  |
| 8 nodes, HT off |      42799       |      145011      | +238.8%  |
| 4 nodes, HT on  |	 61318       |      118445      |  +51.1%  |
| 4 nodes, HT off |     158481       |      158592      |   +0.1%  |
| 2 nodes, HT on  |     180602       |      173967      |   -3.7%  |
| 2 nodes, HT off |     198409       |      198073      |   -0.2%  |
| 1 node , HT on  |     149042       |      147671      |   -0.9%  |
| 1 node , HT off |     126036       |      126533      |   +0.4%  |
|		  |              User Range 200 - 1000		   |
| 8 nodes, HT on  |      41525       |      122349      | +194.6%  |
| 8 nodes, HT off |      49866       |      124032      | +148.7%  |
| 4 nodes, HT on  |	 66409       |      106984      |  +61.1%  |
| 4 nodes, HT off |     119880       |      130508      |   +8.9%  |
| 2 nodes, HT on  |     138003       |      133948      |   -2.9%  |
| 2 nodes, HT off |     132792       |      131997      |   -0.6%  |
| 1 node , HT on  |     116593       |      115859      |   -0.6%  |
| 1 node , HT off |     104499       |      104597      |   +0.1%  |
AIM7 benchmark run has a pretty large run-to-run variance due to random
nature of the subtests executed. So a difference of less than +-5%
may not be really significant.

This patch improves high_systime workload performance at 4 nodes
and up by maintaining transaction rates without significant drop-off
at high node count.  The patch has practically no impact on 1 and 2
nodes system.

The table below shows the percentage time (as reported by perf
record -a -s -g) spent on the __mutex_lock_slowpath() function by
the high_systime workload at 1500 users for 2/4/8-node configurations
with hyperthreading off.

| Configuration | %Time w/o patch | %Time with patch | %Change |
|    8 nodes    |      65.34%     |      0.69%       |  -99%   |
|    4 nodes    |       8.70%	  |      1.02%	     |  -88%   |
|    2 nodes    |       0.41%     |      0.32%       |  -22%   |
It is obvious that the dramatic performance improvement at 8
nodes was due to the drastic cut in the time spent within the
__mutex_lock_slowpath() function.

The table below show the improvements in other AIM7 workloads (at 8
nodes, hyperthreading off).

|   Workload   | mean % change | mean % change  | mean % change   |
|              | 10-100 users  | 200-1000 users | 1100-2000 users |
| alltests     |     +0.6%     |   +104.2%      |   +185.9%       |
| five_sec     |     +1.9%     |     +0.9%      |     +0.9%       |
| fserver      |     +1.4%     |     -7.7%      |     +5.1%       |
| new_fserver  |     -0.5%     |     +3.2%      |     +3.1%       |
| shared       |    +13.1%     |   +146.1%      |   +181.5%       |
| short        |     +7.4%     |     +5.0%      |     +4.2%       |
Signed-off-by: Waiman Long <>
Reviewed-by: Davidlohr Bueso <>
@longman88 longman88 mutex: restrict mutex spinning to only one task per mutex
Date	Thu, 4 Apr 2013 10:54:17 -0400

The current mutex spinning code allow multiple tasks to spin on a
single mutex concurrently. There are two major problems with this

 1. This is not very energy efficient as the spinning tasks are not
    doing useful work. The spinning tasks may also block other more
    important or useful tasks from running as preemption is disabled.
    Only one of the spinners will get the mutex at any time. The
    other spinners will have to wait for much longer to get it.

 2. The mutex data structure on x86-64 should be 32 bytes. The spinning
    code spin on lock->owner which, in most cases, should be in the same
    64-byte cache line as the lock->wait_lock spinlock. As a result,
    the mutex spinners are contending the same cacheline with other
    CPUs trying to get the spinlock leading to increased time spent
    on the spinlock as well as on the mutex spinning.

These problems are worse on system with large number of CPUs. One way
to reduce the effect of these two problems is to allow only one task
to be spinning on a mutex at any time.

This patch adds a new spinner field in the mutex.h to limit the
number of spinner to only one task. That will increase the size of
the mutex by 8 bytes in a 64-bit environment (4 bytes in a 32-bit

The AIM7 benchmarks were run on 3.7.10 derived kernels to show the
performance changes with this patch on a 8-socket 80-core system
with hyperthreading off.  The table below shows the mean % change
in performance over a range of users for some AIM7 workloads with
just the less atomic operation patch (patch 1) vs the less atomic
operation patch plus this one (patches 1+2).

|   Workload   | mean % change   | mean % change   | mean % change   |
|              | 10-100 users    | 200-1000 users  | 1100-2000 users |
| alltests     |     -0.2%       |     -3.8%       |    -4.2%        |
| five_sec     |     -0.6%       |     -2.0%       |    -2.4%        |
| fserver      |     +2.2%       |    +16.2%       |    +2.2%        |
| high_systime |     -0.3%       |     -4.3%       |    -3.0%        |
| new_fserver  |     +3.9%       |    +16.0%       |    +9.5%        |
| shared       |     -1.7%       |     -5.0%       |    -4.0%        |
| short        |     -7.7%       |     +0.2%       |    +1.3%        |
It can be seen that this patch improves performance for the fserver and
new_fserver workloads while suffering some slight drop in performance
for the other workloads.

Signed-off-by: Waiman Long <>
Reviewed-by: Davidlohr Bueso <>
Alex Shi rwsem: steal writing sem for better performance
Commit 5a50508 changes to rwsem from mutex, caused aim7 fork_test
performance to dropped 50%. Yuanhan liu did an analysis, found it was
caused by strict sequential writing. Ingo suggest stealing sem writing from
front task in wait queue.

So does this patch.
In this patch, I just allow write stealing to happen when the first waiter
is also writer. The performance fully is now fully recovered.

Cc: Ingo Molnar <>
Signed-off-by: Alex Shi <>
@mnm9994u lib/rwsem.c: fix compatibility issues with Linux 3.0.y
Change-Id: I1524cdc6894a4bf8243c6c47a17f225a83d9cec2
Volodymyr Mieshkov ext4: prevent kernel panic in case of uninitialized jinode
ext4: prevent kernel panic in case of uninitialized jinode

In some cases the kernel crash occurs during system suspend/resume:

[ 4095.041351] Unable to handle kernel NULL pointer dereference at virtual address 00000000
[ 4095.050689] pgd = c0004000
[ 4095.053985] [00000000] *pgd=00000000
[ 4095.058807] Internal error: Oops: 5 [#1] PREEMPT SMP
[ 4095.064483] Modules linked in: wl12xx mac80211 pvrsrvkm_sgx540_120 cfg80211 compat [last unloaded: wl12xx_sdio]
[ 4095.064575] CPU: 1    Tainted: G    B        (3.0.31-01807-gfac16a0 #1)
[ 4095.064605] PC is at jbd2_journal_file_inode+0x38/0x118
[ 4095.064666] LR is at mpage_da_map_and_submit+0x48c/0x618
[ 4095.064697] pc : [<c01da5a8>]    lr : [<c01aeac0>]    psr: 60000013
[ 4095.064697] sp : c6e07c80  ip : c6e07ca0  fp : c6e07c9c
[ 4095.064727] r10: 00000001  r9 : c6e06000  r8 : 00000179
[ 4095.064758] r7 : c6e07ca0  r6 : c73b8400  r5 : 00000000  r4 : c59a7d80
[ 4095.064758] r3 : 00000038  r2 : 00000800  r1 : 00000000  r0 : c7754fc0
[ 4095.064788] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
[ 4095.064819] Control: 10c5387d  Table: 86cc804a  DAC: 00000015
[ 4095.064849]
[ 4095.064849] PC: 0xc01da528:
[ 4095.064880] a528  0a000003 e3a05000 e1a00005 e24bd020 e89da9f0 e5951010 e3e06000 e14b22dc
[ 4095.070373] 7fe0: c00a48ac 00000013 00000000 c6e07ff8 c00a48ac c00c0a94 84752f09 60772177
[ 4095.070404] Backtrace:
[ 4095.070465] [<c01da570>] (jbd2_journal_file_inode+0x0/0x118) from [<c01aeac0>] (mpage_da_map_and_submit+0x48c/0x618)
[ 4095.070495]  r7:c6e07ca0 r6:c6e07d00 r5:c6e07d90 r4:c7754fc0
[ 4095.070556] [<c01ae634>] (mpage_da_map_and_submit+0x0/0x618) from [<c01af40c>] (ext4_da_writepages+0x2a4/0x5c8)
[ 4095.070617] [<c01af168>] (ext4_da_writepages+0x0/0x5c8) from [<c0112af4>] (do_writepages+0x34/0x40)
[ 4095.070678] [<c0112ac0>] (do_writepages+0x0/0x40) from [<c01645a4>] (writeback_single_inode+0xd4/0x288)
[ 4095.070709] [<c01644d0>] (writeback_single_inode+0x0/0x288) from [<c0164ed4>] (writeback_sb_inodes+0xb4/0x184)
[ 4095.070770] [<c0164e20>] (writeback_sb_inodes+0x0/0x184) from [<c01655a0>] (writeback_inodes_wb+0xc4/0x13c)
[ 4095.070831] [<c01654dc>] (writeback_inodes_wb+0x0/0x13c) from [<c01658f0>] (wb_writeback+0x2d8/0x464)
[ 4095.070861] [<c0165618>] (wb_writeback+0x0/0x464) from [<c0165cb8>] (wb_do_writeback+0x23c/0x2c4)
[ 4095.070922] [<c0165a7c>] (wb_do_writeback+0x0/0x2c4) from [<c0165df4>] (bdi_writeback_thread+0xb4/0x2dc)
[ 4095.070953] [<c0165d40>] (bdi_writeback_thread+0x0/0x2dc) from [<c00c0b18>] (kthread+0x90/0x98)
[ 4095.071014] [<c00c0a88>] (kthread+0x0/0x98) from [<c00a48ac>] (do_exit+0x0/0x72c)
[ 4095.071044]  r7:00000013 r6:c00a48ac r5:c00c0a88 r4:c78c7ec4
[ 4095.071105] Code: e89da8f0 e5963000 e3130002 1afffffa (e5913000)
[ 4095.071166] ---[ end trace 7fe9f9b727e5cf78 ]---
[ 4095.071197] Kernel panic - not syncing: Fatal exception

The probably reason of such behaviour is an inode opened in READ mode
has been marked as 'dirty' somehow and written back by ext4_da_writepages.
Cause jinode == NULL it could lead to the kernel panic.

The patch prevents kernel panic and helps to investigate the problem
providing an inode number.

Change-Id: I1d77a011b580db682b8e2d122ef3d5e44e0ce5c7
Signed-off-by: Volodymyr Mieshkov <>
@mnm9994u 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

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

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
    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

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 <>
modified for Mako kernel from LKML reference

Change-Id: I44b4bcf90506f5d30406a783378bc601bbe33622
Alex Shi rwsem: steal writing sem for better performance
Commit 5a50508 changes to rwsem from mutex, caused aim7 fork_test
performance to dropped 50%. Yuanhan liu did an analysis, found it was
caused by strict sequential writing. Ingo suggest stealing sem writing from
front task in wait queue.

So does this patch.
In this patch, I just allow write stealing to happen when the first waiter
is also writer. The performance fully is now fully recovered.

Cc: Ingo Molnar <>
Signed-off-by: Alex Shi <>


@franciscofranco franciscofranco drivers: mmc: disable CRC
Signed-off-by: Francisco Franco <>
Signed-off-by: Seongmin Park <>
Sujit Reddy Thumma mmc: core: Fix possbile memory leak
Fix possible memory leak detected by kmemleak:

unreferenced object 0xc0f80f00 (size 64):
  comm "swapper/0", pid 1, jiffies 4294937508 (age 82.980s)
  hex dump (first 32 bytes):
    6d 6d 63 30 5f 64 65 74 65 63 74 00 72 79 2e 68  mmc0_detect.ry.h
    00 07 00 00 68 77 63 61 70 2e 68 00 02 00 00 70  ....hwcap.h....p
    [<c010a1fc>] __kmalloc+0x164/0x220
    [<c01e1630>] kvasprintf+0x38/0x58
    [<c01e1668>] kasprintf+0x18/0x24
    [<c02fcf60>] mmc_alloc_host+0x114/0x1b4
    [<c0311c84>] msmsdcc_probe+0xc14/0x1fd8
    [<c022b40c>] platform_drv_probe+0x14/0x18
    [<c022a144>] driver_probe_device+0x144/0x334
    [<c022a394>] __driver_attach+0x60/0x84
    [<c022884c>] bus_for_each_dev+0x4c/0x78
    [<c0229720>] bus_add_driver+0xd0/0x250
    [<c022a884>] driver_register+0x9c/0x128
    [<c00086bc>] do_one_initcall+0x90/0x160
    [<c06d1904>] kernel_init+0xe8/0x1a4
    [<c000ee4c>] kernel_thread_exit+0x0/0x8
    [<ffffffff>] 0xffffffff

Change-Id: I3b29d71463af849a072cabbe56637adf6db6d0da
Signed-off-by: Sujit Reddy Thumma <>
Signed-off-by: Francisco Franco <>
@franciscofranco franciscofranco power: decrease the amount of time the device waits after entering lo…
…w power mode to freeze processes. Testing phase at the moment.

Signed-off-by: franciscofranco <>
Anurag Singh input: evdev: Move wake_lock_destroy call
Calling wake_lock_destroy from inside a spinlock
protected region (or, in general, from atomic context)
leads to a 'scheduling while atomic bug' because the
internal wakeup source deletion logic calls
synchronize_rcu, which can sleep. Moreover,
since the interal lists are already protected with
RCUs and spinlocks, putting the wake_lock_destroy
call in a spinlock is redundant.

Change-Id: I10a2239b664a5f43e54495f24fe588fb09282305
Signed-off-by: Anurag Singh <>
Signed-off-by: franciscofranco <>
@markus-oberhumer markus-oberhumer lib/lzo: Rename lzo1x_decompress.c to lzo1x_decompress_safe.c
Rename the source file to match the function name and thereby
also make room for a possible future even slightly faster
"non-safe" decompressor version.

Change-Id: I482ee415d43c5aaa77d34946ae1fa0af5465b007
Signed-off-by: Markus F.X.J. Oberhumer <>
@markus-oberhumer markus-oberhumer lib/lzo: Update LZO compression to current upstream version
This commit updates the kernel LZO code to the current upsteam version
which features a significant speed improvement - benchmarking the Calgary
and Silesia test corpora typically shows a doubled performance in
both compression and decompression on modern i386/x86_64/powerpc machines.

Change-Id: Ifcde45460c856644097bdeb612f0d68c6429f03c
Signed-off-by: Markus F.X.J. Oberhumer <>
@markus-oberhumer markus-oberhumer lib/lzo: huge LZO decompression speedup on ARM by using unaligned access
Change-Id: I4dc172b2822504c3f2db1913ed9404e031861d55
Signed-off-by: Markus F.X.J. Oberhumer <>
@wildea01 wildea01 ARM: kconfig: select HAVE_EFFICIENT_UNALIGNED_ACCESS for CPUv6+ && MMU
Modern ARM CPUs can perform efficient unaligned memory accesses in
hardware and this feature is relied up on by code such as the dcache
word-at-a-time name hashing.

[pawitp: adapt to kernel 3.0]

Change-Id: I41559fc9255229e2601f4bef28aa8d48246156b7
Signed-off-by: Will Deacon <>
@minchank minchank mm: remove compressed copy from zram in-memory
Swap subsystem does lazy swap slot free with expecting the page would be
swapped out again so we can avoid unnecessary write.

But the problem in in-memory swap(ex, zram) is that it consumes memory
space until vm_swap_full(ie, used half of all of swap device) condition
meet.  It could be bad if we use multiple swap device, small in-memory
swap and big storage swap or in-memory swap alone.

This patch makes swap subsystem free swap slot as soon as swap-read is
completed and make the swapcache page dirty so the page should be
written out the swap device to reclaim it.  It means we never lose it.

I tested this patch with kernel compile workload.

1. before

   compile time : 9882.42
   zram max wasted space by fragmentation: 13471881 byte
   memory space consumed by zram: 174227456 byte
   the number of slot free notify: 206684

2. after

   compile time : 9653.90
   zram max wasted space by fragmentation: 11805932 byte
   memory space consumed by zram: 154001408 byte
   the number of slot free notify: 426972

[ tweak comment text]
[ fix BUG due to non-swapcache pages in end_swap_bio_read()]
[ invert unlikely() test, augment comment, 80-col cleanup]
Signed-off-by: Dan Magenheimer <>
Signed-off-by: Minchan Kim <>
Signed-off-by: Artem Savkov <>
Cc: Hugh Dickins <>
Cc: Seth Jennings <>
Cc: Nitin Gupta <>
Cc: Konrad Rzeszutek Wilk <>
Cc: Shaohua Li <>
Signed-off-by: Andrew Morton <>
Signed-off-by: Linus Torvalds <>


Change-Id: I8f11fb7f0391954435002e7f290352f311c907d4