power: Avoids bogus error messages for the suspend aborts.

Avoids printing bogus error message "tasks refusing to freeze", in cases
where pending wakeup source caused the suspend abort.

Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
Change-Id: I913ad290f501b31cd536d039834c8d24c6f16928
cpufreq: cpu-boost: we can hit a small performance loss by not queuing input works less than 150ms apart when our default input work duration is only 40ms, so use that 40ms as a magic value instead of the 150ms minimum interval.

Change-Id: I63620165d8576be1b1072018e450b45e46ba462b
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
Headset: Ability to hang-up a call from a wired audio headset

Address OPO_52.
The KEY_MEDIA and KEY_VOLUMEUP are mapped to multiple buttons.
That will confuse the input class driver when one button is
pressed while others are released. Fuse all buttons with same
function to one will fix the problem.

Change-Id: Ife63602e68d0fad2813821f0c7e0b6d78cc5d878
msm8974: Stop breaking the whole system

 * Deep breath............

   .....

 * Carveout allocations must be inside a memory { } stanza.

Change-Id: Ica240acec74acfd2180182d7a2725889452af5f6
cpufreq: Avoid using global variable total_cpus

The change is to compile on kernels where cpufreq stats are compiled as
a module (CONFIG_CPU_FREQ_STAT=m), because total_cpus is not exported for
module use.

Reported-By: Emilio López <elopez93@gmail.com>
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
Change-Id: I4f3c74f0fac5e8d9449655b26bf3b407b0fe4290
block: deadline: Optimize for non-rotational

Change-Id: Ib225a03691c7cc6430d7017d64a81617b594a40f
block: Disable IO Stats

* I see no need to have this enabled.  Will test to verify that it is not needed.

Change-Id: I1d79d6eea8e2ff60b3d6b4f96d187a1d1863fa98
Signed-off-by: Chester Kener <Cl3Kener@gmail.com>
SELinux: Reduce overhead of mls_level_isvalid() function call

Date	Mon, 10 Jun 2013 13:55:08 -0400

v4->v5:
  - Fix scripts/checkpatch.pl warning.

v3->v4:
  - Merge the 2 separate while loops in ebitmap_contains() into
    a single one.

v2->v3:
  - Remove unused local variables i, node from mls_level_isvalid().

v1->v2:
 - Move the new ebitmap comparison logic from mls_level_isvalid()
   into the ebitmap_contains() helper function.
 - Rerun perf and performance tests on the latest v3.10-rc4 kernel.

While running the high_systime workload of the AIM7 benchmark on
a 2-socket 12-core Westmere x86-64 machine running 3.10-rc4 kernel
(with HT on), it was found that a pretty sizable amount of time was
spent in the SELinux code. Below was the perf trace of the "perf
record -a -s" of a test run at 1500 users:

  5.04%            ls  [kernel.kallsyms]     [k] ebitmap_get_bit
  1.96%            ls  [kernel.kallsyms]     [k] mls_level_isvalid
  1.95%            ls  [kernel.kallsyms]     [k] find_next_bit

The ebitmap_get_bit() was the hottest function in the perf-report
output.  Both the ebitmap_get_bit() and find_next_bit() functions
were, in fact, called by mls_level_isvalid(). As a result, the
mls_level_isvalid() call consumed 8.95% of the total CPU time of
all the 24 virtual CPUs which is quite a lot. The majority of the
mls_level_isvalid() function invocations come from the socket creation
system call.

Looking at the mls_level_isvalid() function, it is checking to see
if all the bits set in one of the ebitmap structure are also set in
another one as well as the highest set bit is no bigger than the one
specified by the given policydb data structure. It is doing it in
a bit-by-bit manner. So if the ebitmap structure has many bits set,
the iteration loop will be done many times.

The current code can be rewritten to use a similar algorithm as the
ebitmap_contains() function with an additional check for the
highest set bit. The ebitmap_contains() function was extended to
cover an optional additional check for the highest set bit, and the
mls_level_isvalid() function was modified to call ebitmap_contains().

With that change, the perf trace showed that the used CPU time drop
down to just 0.08% (ebitmap_contains + mls_level_isvalid) of the
total which is about 100X less than before.

  0.07%            ls  [kernel.kallsyms]     [k] ebitmap_contains
  0.05%            ls  [kernel.kallsyms]     [k] ebitmap_get_bit
  0.01%            ls  [kernel.kallsyms]     [k] mls_level_isvalid
  0.01%            ls  [kernel.kallsyms]     [k] find_next_bit

The remaining ebitmap_get_bit() and find_next_bit() functions calls
are made by other kernel routines as the new mls_level_isvalid()
function will not call them anymore.

This patch also improves the high_systime AIM7 benchmark result,
though the improvement is not as impressive as is suggested by the
reduction in CPU time spent in the ebitmap functions. The table below
shows the performance change on the 2-socket x86-64 system (with HT
on) mentioned above.

+--------------+---------------+----------------+-----------------+
|   Workload   | mean % change | mean % change  | mean % change   |
|              | 10-100 users  | 200-1000 users | 1100-2000 users |
+--------------+---------------+----------------+-----------------+
| high_systime |     +0.1%     |     +0.9%      |     +2.6%       |
+--------------+---------------+----------------+-----------------+

Change-Id: I7cc07edcc6a6a8dadb01c047e3e3cdc7627be44f
Signed-off-by: Waiman Long <Waiman.Long@hp.com>
selinux: fix inode security list corruption

sb_finish_set_opts() can race with inode_free_security()
when initializing inode security structures for inodes
created prior to initial policy load or by the filesystem
during ->mount().   This appears to have always been
a possible race, but commit 3dc91d4 ("SELinux:  Fix possible
NULL pointer dereference in selinux_inode_permission()")
made it more evident by immediately reusing the unioned
list/rcu element  of the inode security structure for call_rcu()
upon an inode_free_security().  But the underlying issue
was already present before that commit as a possible use-after-free
of isec.

Shivnandan Kumar reported the list corruption and proposed
a patch to split the list and rcu elements out of the union
as separate fields of the inode_security_struct so that setting
the rcu element would not affect the list element.  However,
this would merely hide the issue and not truly fix the code.

This patch instead moves up the deletion of the list entry
prior to dropping the sbsec->isec_lock initially.  Then,
if the inode is dropped subsequently, there will be no further
references to the isec.

Change-Id: I8b17d4974199d0850e989d04bb33aa0a9b15ce65
Reported-by: Shivnandan Kumar <shivnandan.k@samsung.com>
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
Cc: stable@vger.kernel.org
Signed-off-by: Paul Moore <pmoore@redhat.com>
mm: vmscan: reduce swappiness from 60 to 10

Change-Id: Ibc827bad9c39a40054b6803687b062643edc49f7
Add my Hotplug driver.

Change-Id: I31966aa78d141774090e3e5044c02bccf8580c9e
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
mako_hotplug: we can live with 80% threshold.

Change-Id: I7f7c8bc6f5af7e02f74c91b5235d8c3f9d324d62
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
mako_hotplug: we can now cap max freq to 1GHz on screen off.

Change-Id: I832c035aeaf7896ee3dd76253a63cbd0056a0374
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
mako_hotplug: without updating the policy nothing actually happened.

Change-Id: I3ba8c1f8d4288adcc21af9b73b95696ba09bcce3
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
mako_hotplug: make sure the notifier does not go through for every damn CPUFREQ_ADJUST otherwise it's a mess.

Change-Id: I1abbc5cd36838aeea3d74db4e24c7e72a541c00b
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
mako_hotplug: lets try this fix for the crippling sound when changing networks.

Change-Id: I56e9695aa1dd3ccc6a94b2432263bf6fe399571d
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
mako_hotplug: minor code optimisations.

Change-Id: I9cb4138141d8096d33610df3bbee9175f91d55d3
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
mako_hotplug: small fix to make sure we don't try to cpu_up(x) if x is alread online.

Change-Id: I9f2f65b04140ea74363639fbd61545d6e3e30b18
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
mako_hotplug: clean-up

* clean up the store functions using proper and modern kstrtoul

Change-Id: I258f539b37945c817a71ddd6a1371832d9d812eb
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
mako_hotplug: bugfixing

* fix a bug where cpu_smash()->cpus_cpufreq_work()->cpus_offline_work()
was being called every 100ms

Change-Id: I07fa9b95b77994bd36ba9cd3e8c93298ea42bfff
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>