The current jhash.h implements the lookup2() hash function by Bob Jenkins.
However, lookup2() is outdated as Bob wrote a new hash function called
lookup3(). The new hash function

- mixes better than lookup2(): it passes the check that every input bit
changes every output bit 50% of the time, while lookup2() failed it.
- performs better: compiled with -O2 on Core2 Duo, lookup3() is 20-40%
faster than lookup2() depending on the key length.

The patch replaces the lookup2() implementation of the 'jhash*'
functions with that of lookup3() in linux/jhash.h.

You can read a longer comparison of the Jenkins and other hash functions
at http://burtleburtle.net/bob/hash/doobs.html.

Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Decompressors: Get rid of set_error_fn() macro

set_error_fn() has become a useless complication after the commit
c1e7c3ae59b065bf7ff24a05cb609b2f9e314db6 fixed the use of error()
in malloc(). Only decompress_unlzma.c had some use for it and that
was easy to change too.

This also gets rid of the static function pointer "error", which
should have been marked as __initdata.

Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
arm: Implement ticket spin-locks

Introduce optional ticket locks to help ensure fairness in
contended locks, as well as preventing livelock.

CRs-fixed: 302764
Signed-off-by: Brent DeGraaf <bdegraaf@codeaurora.org>
(cherry picked from commit bdd8a9ce573917b5de9f2340a5f9530d465ea731)

Change-Id: I8f4aece6ce1228f54407785ba05674b6e31f7c7c
Signed-off-by: Shruthi Krishna <skrish@codeaurora.org>
PM: wakelocks: Display wakelocks preventing suspend by default

Use DEBUG_WAKEUP flag to show wakelocks that abort suspend, in
addition to showing wakelocks held during system resume.
DEBUG_WAKEUP is enabled by default.

Change-Id: If6fa68e8afbc482a5300ffab2964694b02b34f41
Signed-off-by: Todd Poynor <toddpoynor@google.com>
kernel: Set the command name of the idle tasks in SMP kernels v3

In UP systems, the idle task is initialized using the init_task
structure from which the command name is taken (currently "swapper").

In SMP systems, one idle task per CPU is forked by the worker thread
from which the task structure is copied. The command name is, therefore,
"kworker/0:0" or "kworker/0:1", if not updated. Since such update was
lacking, all idle tasks in SMP systems were incorrectly named. This
longtime bug was not discovered immediately, because there is no /proc/0
entry - the bug only becomes apparent when tracing is enabled.

This patch sets the command name of the idle tasks in SMP systems to the
name that is used in the INIT_TASK structure suffixed by a slash and the
number of the CPU.

Signed-off-by: Carsten Emde <C.Emde@osadl.org>
CPU hotplug, PM: Remove unused symbol 'suspend_cpu_hotplug'

Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
msm: platsmp: Remove extraneous boot_secondary delay

Change msleep_interruptible to usleep. msleep_interruptible
takes around 16 ms to return while the secondary CPU can
come up in about 1.5 ms. usleep is much finer grained and
returns every .5 ms. This allows boot_secondary to complete
much more quickly.

Signed-off-by: Maya Spivak <mspivak@codeaurora.org>
(cherry picked from commit 5e1770668107ea31f9ec3fa4ac04be48cff8e470)

Change-Id: I49b32101667b1c2bfd7ecacf6a1c96db2a696afc
Signed-off-by: Swetha Basineni <sbasin@codeaurora.org>
cpu-hotplug: Add the function 'cpu_hotplug_inprogress'

Allows a caller to detect whether a cpu hotplug operation
is in progress. This is useful for optimizing code paths
based on this condition.

Signed-off-by: Maya Spivak <mspivak@codeaurora.org>
(cherry picked from commit 9f6cabec8fd0d0cb95084d18ee7cddbcf922ac2d)

Change-Id: I2eae7fbb819e3a776dba77a061eb89f30ac3176d
Signed-off-by: Swetha Basineni <sbasin@codeaurora.org>
printk: Don't allow cpu to get console lock during hotplugging

The flush of the console takes unnecessary time during the cpu
hotplug up operation.  It can delay the rcu synchronize_sched
operation, which in turn delays the hotplug operation. The flush
delays rcu synchronize_sched during scheduling domain creation
by up to 100 ms by interrupting the move to a quiescent state.
This change delays the flush of the console to later in the
notification chain of cpu_online. At the point in the cpu_up
operation where the flush now occurs, other tasks can already
be scheduled on the cpu that just came up.

Signed-off-by: Maya Spivak <mspivak@codeaurora.org>
(cherry picked from commit c7108258d7e44b56842f8215e31d7310f86febaa)

Change-Id: I2986071a5b05760e05d86da2f33ea2a9fe882469
Signed-off-by: Swetha Basineni <sbasin@codeaurora.org>
rcu-tree: Check for extended quiescent state at start of gp

During a cpu_hotplug event, it is much more likely for a cpu to be in
extended quiescent state. For example, on cpu_up, tasks are not yet
schedulable on the cpu that is coming up, so that cpu will not context
switch.  Additionally, cpu_down occurs on our dual-core system when
there is not a heavy load on the cpus, which means the cpus are less
likely to context switch. Checking for extended quiescent state at the
beginning of the grace period decreases the hotplug latency because the
rcu process does not necessarily have to wait tens of milliseconds to
force a quiescent state.

Signed-off-by: Maya Spivak <mspivak@codeaurora.org>
(cherry picked from commit 18f8787b8c476fe5e55f0415361faf5d437b76be)

Change-Id: I73063c4065395782cc2750db3086666f3474f9a4
Signed-off-by: Swetha Basineni <sbasin@codeaurora.org>
partition_sched_domains: Do not destroy old sched domain on cpu_up

This is safe on a cpu_up only. Although a reader may still have
access to the old scheduling domain data, the data indicates that
the new CPU is not up, and therefore the only limitation is the
new CPU will not be schedulable by that reader until that reader
receives the new data.

Signed-off-by: Maya Spivak <mspivak@codeaurora.org>
(cherry picked from commit f963077fba323bd06814639a691bd905006bb541)

Change-Id: I15b3e0fd8c182e14db1c14f2a45b467f24d41cc5
Signed-off-by: Swetha Basineni <sbasin@codeaurora.org>
dm-cache: block level disk cache target for device mapper

This is the first cut of a device-mapper target which provides a write-back
or write-through block cache.  It is intended to be used in conjunction with
remote block devices such as iSCSI or ATA-over-Ethernet, particularly in
cluster situations.

In performance tests with iSCSI, gave peformance improvements of 2-10x that
of iSCSI alone when Postmark or Bonnie loads were applied from 8 clients to
a single server.  Evidence suggests even greater differences on larger
clusters.  A detailed performance analysis will be vailable shortly via a
technical report on IBM's CyberDigest.

This module was developed during an intership at IBM Research by
Ming Zhao.  Please direct comments to both Ming and myself.

Signed-off-by: Eric Van Hensbergen <ericvh.gmail.com>
backported from 2.6.39 baseline for use on 2.6.35 by faux123
sched: don't call task_group() many times in set_task_rq()

It improves perfomance, especially if autogroup enabled.

The size of set_task_rq() was 0x180 and now it is 0xa0.

Signed-off-by: Andrew Vagin <avagin@openvz.org>
kernel:sched: LOAD_FREQ (4*HZ+61) avoids loadavg Moire

LOAD_FREQ is (5*HZ+1) to avoid high load average when idle:
http://kerneltrap.org/mailarchive/linux-kernel/2007/10/3/328568

I suggest (4*HZ+61) for a better distribution.

With some seconds based load (like SSL heartbeats)
and LOAD_FREQ at (5*HZ+1) I see Moire patterns like inverse sawtooth,
since 2 or 3 probes hit the jobs (load increases quickly),
followed by several probes missing it.

A 4.61 sec interval gives optimal distribution over when within a
second a probe is taken, as .61 is close to golden ratio phi 1.618...
(test in http://ripke.com/goldenratio.c).

12*4.61 = 55.32 secs is still close to a minute,
and 13*4.61=59.93 is even closer than the current 12*5.01=60.12
(with exponents EXP_x adjusted to a ratio of 13 instead of 12).