safe/jmp/linux-2.6
16 years agopvr2fb: Fix oops when pseudo_palette is written
Antonino A. Daplas [Fri, 10 Aug 2007 20:00:47 +0000 (13:00 -0700)]
pvr2fb: Fix oops when pseudo_palette is written

Reported by: Adrian McMenamin <adrianmcmenamin@gmail.com>

This driver will oops when the pseudo_palette[] is written as u32 but not when
written as u16.  When written as u32, it corrupts the adjacent 'mmio_base'
field of struct pvr2fb_par.  Fix by using framebuffer_alloc()/release() to
allocate struct fb_info and struct pvr2fb_par, and create the pseudo_palette[]
as part of struct pvr2fb_par.

Signed-off-by: Antonino Daplas <adaplas@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agofbcon: Kill compile warning
Antonino A. Daplas [Fri, 10 Aug 2007 20:00:46 +0000 (13:00 -0700)]
fbcon: Kill compile warning

Fix compile warning ('map_override unused') if fbcon is compiled as a module
and CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=n.

[akpm@linux-foundation.org: cleanup]
Signed-off-by: Antonino Daplas <adaplas@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agostifb: detect cards in double buffer mode more reliably
Helge Deller [Fri, 10 Aug 2007 20:00:45 +0000 (13:00 -0700)]
stifb: detect cards in double buffer mode more reliably

Visualize-EG, Graffiti and A4450A graphics cards on PARISC can
be configured in double-buffer and standard mode, but the stifb
driver supports standard mode only.
This patch detects double-buffered cards more reliable.

It is a real bugfix for a very nasty problem for all parisc users which have
wrongly configured their graphic card.  The problem: The stifb graphics driver
will not detect that the card is wrongly configured and then nevertheless just
enables the graphics mode, which it shouldn't.  In the end, the user will see
no further updates / boot messages on the screen.

We had documented this problem already on our FAQ
(http://parisc-linux.org/faq/index.html#viseg "Why do I get corrupted graphics
with my Vis-EG/Graffiti/A4450A card?") but people still run into this problem.
 So having this fix in as early as possible can help us.

Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Antonino Daplas <adaplas@gmail.com>
Cc: <stable@kernel.org>
Cc: Kyle McMartin <kyle@mcmartin.ca>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agodirect-io: fix error-path crashes
Badari Pulavarty [Fri, 10 Aug 2007 20:00:44 +0000 (13:00 -0700)]
direct-io: fix error-path crashes

Need to initialize map_bh.b_state to zero.  Otherwise, in case of a faulty
user-buffer its possible to go into dio_zero_block() and submit a page by
mistake - since it checks for buffer_new().

http://marc.info/?l=linux-kernel&m=118551339032528&w=2

akpm: Linus had a (better) patch to just do a kzalloc() in there, but it got
lost.  Probably this version is better for -stable anwyay.

Signed-off-by: Badari Pulavarty <pbadari@us.ibm.com>
Acked-by: Joe Jin <joe.jin@oracle.com>
Acked-by: Zach Brown <zach.brown@oracle.com>
Cc: gurudas pai <gurudas.pai@oracle.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agox86_64: fix HPET init race
Robin Holt [Fri, 10 Aug 2007 20:00:43 +0000 (13:00 -0700)]
x86_64: fix HPET init race

I have had four seperate system lockups attributable to this exact problem
in two days of testing.  Instead of trying to handle all the weird end
cases and wrap, how about changing it to look for exactly what we appear
to want.

The following patch removes a couple races in setup_APIC_timer.  One occurs
when the HPET advances the COUNTER past the T0_CMP value between the time
the T0_CMP was originally read and when COUNTER is read.  This results in
a delay waiting for the counter to wrap.  The other results from the counter
wrapping.

This change takes a snapshot of T0_CMP at the beginning of the loop and
simply loops until T0_CMP has changed (a tick has happened).

<later>

I have one small concern about the patch.  I am not sure it meets the intent
as well as it should.  I think we are trying to match APIC timer interrupts up
with the hpet counter increment.  The event which appears to be disturbing
this loop in our test environment is the NMI watchdog.  What we believe has
been happening with the existing code is the setup_APIC_timer loop has read
the CMP value, and the NMI watchdog code fires for the first time.  This
results in a series of icache miss slowdowns and by the time we get back to
things it has wrapped.

I think this code is trying to get the CMP as close to the counter value as
possible.  If that is the intent, maybe we should really be testing against a
"window" around the CMP.  Something like COUNTER = CMP+/2.  It appears COUNTER
should get advanced every 89nSec (IIRC).  The above seems like an unreasonably
small window, but may be necessary.  Without documentation, I am not sure of
the original intent with this code.

In summary, this code fixes my boot hangs, but since I am not certain of the
intent of the existing code, I am not certain this has not introduced new bugs
or unexpected behaviors.

Signed-off-by: Robin Holt <holt@sgi.com>
Acked-by: Andi Kleen <ak@suse.de>
Cc: Vojtech Pavlik <vojtech@suse.cz>
Cc: "Aaron Durbin" <adurbin@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoBlackfin arch: after removing fs.h from mm.h, fix the broken on Blackfin arch
Bryan Wu [Fri, 10 Aug 2007 20:00:42 +0000 (13:00 -0700)]
Blackfin arch: after removing fs.h from mm.h, fix the broken on Blackfin arch

Cc: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoSLUB: Fix format specifier in Documentation/vm/slabinfo.c
Jesper Juhl [Wed, 8 Aug 2007 23:31:30 +0000 (16:31 -0700)]
SLUB: Fix format specifier in Documentation/vm/slabinfo.c

There's a little problem in Documentation/vm/slabinfo.c
The code is using "%d" in a printf() call to print an 'unsigned long'.
This patch corrects it to use "%lu" instead.

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: Christoph Lameter <clameter@sgi.com>
16 years agoSLUB: Fix dynamic dma kmalloc cache creation
Christoph Lameter [Tue, 7 Aug 2007 22:11:48 +0000 (15:11 -0700)]
SLUB: Fix dynamic dma kmalloc cache creation

The dynamic dma kmalloc creation can run into trouble if a
GFP_ATOMIC allocation is the first one performed for a certain size
of dma kmalloc slab.

- Move the adding of the slab to sysfs into a workqueue
  (sysfs does GFP_KERNEL allocations)
- Do not call kmem_cache_destroy() (uses slub_lock)
- Only acquire the slub_lock once and--if we cannot wait--do a trylock.

  This introduces a slight risk of the first kmalloc(x, GFP_DMA|GFP_ATOMIC)
  for a range of sizes failing due to another process holding the slub_lock.
  However, we only need to acquire the spinlock once in order to establish
  each power of two DMA kmalloc cache. The possible conflict is with the
  slub_lock taken during slab management actions (create / remove slab cache).

  It is rather typical that a driver will first fill its buffers using
  GFP_KERNEL allocations which will wait until the slub_lock can be acquired.
  Drivers will also create its slab caches first outside of an atomic
  context before starting to use atomic kmalloc from an interrupt context.

  If there are any failures then they will occur early after boot or when
  loading of multiple drivers concurrently. Drivers can already accomodate
  failures of GFP_ATOMIC for other reasons. Retries will then create the slab.

Signed-off-by: Christoph Lameter <clameter@sgi.com>
16 years agoSLUB: Remove checks for MAX_PARTIAL from kmem_cache_shrink
Christoph Lameter [Mon, 30 Jul 2007 20:06:46 +0000 (13:06 -0700)]
SLUB: Remove checks for MAX_PARTIAL from kmem_cache_shrink

The MAX_PARTIAL checks were supposed to be an optimization. However, slab
shrinking is a manually triggered process either through running slabinfo
or by the kernel calling kmem_cache_shrink.

If one really wants to shrink a slab then all operations should be done
regardless of the size of the partial list. This also fixes an issue that
could surface if the number of partial slabs was initially above MAX_PARTIAL
in kmem_cache_shrink and later drops below MAX_PARTIAL through the
elimination of empty slabs on the partial list (rare). In that case a few
slabs may be left off the partial list (and only be put back when they
are empty).

Signed-off-by: Christoph Lameter <clameter@sgi.com>
16 years agoremove dubious legal statment from uio-howto
Alan Cox [Wed, 8 Aug 2007 23:57:54 +0000 (00:57 +0100)]
remove dubious legal statment from uio-howto

UIO currently contains a rather dubious statement which wants removing.

The actual questions around whether user space code that depends tightly
on kernel GPL code designed to co-work with it are derivative works of
the kernel is extremely complex, and since we don't have space for either
a masters length essay on legal issues or need to start flamewars lets
simply remove the comment and leave law to lawyers

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <tovalds@linux-foundation.org>
16 years agoFix Alpha O_CLOEXEC definition
Richard Henderson [Wed, 8 Aug 2007 20:17:08 +0000 (13:17 -0700)]
Fix Alpha O_CLOEXEC definition

The default definition in asm-generic conflicts with Alpha's O_DIRECT,
so, like several other arches, it needs to be redefined.

Signed-off-by: Richard Hendersion <rth@twiddle.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoMerge git://git.linux-nfs.org/pub/linux/nfs-2.6
Linus Torvalds [Thu, 9 Aug 2007 15:38:14 +0000 (08:38 -0700)]
Merge git://git.linux-nfs.org/pub/linux/nfs-2.6

* git://git.linux-nfs.org/pub/linux/nfs-2.6:
  SUNRPC: Replace flush_workqueue() with cancel_work_sync() and friends
  NFS: Replace flush_scheduled_work with cancel_work_sync() and friends
  SUNRPC: Don't call gss_delete_sec_context() from an rcu context
  NFSv4: Don't call put_rpccred() from an rcu callback
  NFS: Fix NFSv4 open stateid regressions
  NFSv4: Fix a locking regression in nfs4_set_mode_locked()
  NFS: Fix put_nfs_open_context
  SUNRPC: Fix a race in rpciod_down()

16 years agohexdump: use const notation
Artem Bityutskiy [Tue, 7 Aug 2007 20:43:14 +0000 (23:43 +0300)]
hexdump: use const notation

Trivial fix: mark the buffer to hexdump as const so callers could avoid
casting their const buffers when calling print_hex_dump().

The patch is really trivial and I suggest to consider it as a fix
(it fixes GCC warnings) and push it to current tree.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoMerge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Linus Torvalds [Thu, 9 Aug 2007 15:31:03 +0000 (08:31 -0700)]
Merge branch 'master' of /linux/kernel/git/davem/net-2.6

* 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6:
  [TCP]: H-TCP maxRTT estimation at startup
  [NETFILTER]: nf_nat: add symbolic dependency on IPv4 conntrack
  [NETFILTER]: ctnetlink: return EEXIST instead of EINVAL for existing nat'ed conntracks
  [NETFILTER]: ipt_recent: avoid a possible NULL pointer deref in recent_seq_open()
  [NET] net/core/utils: fix sparse warning
  [NetLabel]: add missing rcu_dereference() calls in the LSM domain mapping hash table
  [PATCH] mac80211: don't allow scanning in monitor mode
  [PATCH] mac80211: Fix sparse error for sta_last_seq_ctrl_read
  [PATCH] mac80211: use do { } while (0) for multi-line macros
  [PATCH] mac80211: missing dev_put in ieee80211_master_start_xmit

16 years agoMerge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6
Linus Torvalds [Thu, 9 Aug 2007 15:27:25 +0000 (08:27 -0700)]
Merge branch 'master' of /linux/kernel/git/davem/sparc-2.6

* 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6:
  [SPARC64]: Fix memory leak when cpu hotplugging.
  [SPARC64]: Do not assume sun4v chips have load-twin/store-init support.
  [SPARC64]: Fix hard-coding of cpu type output in /proc/cpuinfo on sun4v.
  [SPARC]: Centralize find_in_proplist() instead of duplicating N times.

16 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/drzeus/mmc
Linus Torvalds [Thu, 9 Aug 2007 15:23:47 +0000 (08:23 -0700)]
Merge branch 'for-linus' of git://git./linux/kernel/git/drzeus/mmc

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/drzeus/mmc:
  mmc: at91_mci: remove whitespace at the end of lines
  mmc: reorganize bounce buffer init
  wbsd: fix section mismatch warnings

16 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/mingo/linux-2.6-sched
Linus Torvalds [Thu, 9 Aug 2007 15:23:31 +0000 (08:23 -0700)]
Merge git://git./linux/kernel/git/mingo/linux-2.6-sched

* git://git.kernel.org/pub/scm/linux/kernel/git/mingo/linux-2.6-sched: (61 commits)
  sched: refine negative nice level granularity
  sched: fix update_stats_enqueue() reniced codepath
  sched: round a bit better
  sched: make the multiplication table more accurate
  sched: optimize update_rq_clock() calls in the load-balancer
  sched: optimize activate_task()
  sched: clean up set_curr_task_fair()
  sched: remove __update_rq_clock() call from entity_tick()
  sched: move the __update_rq_clock() call to scheduler_tick()
  sched debug: remove the 'u64 now' parameter from print_task()/_rq()
  sched: remove the 'u64 now' local variables
  sched: remove the 'u64 now' parameter from deactivate_task()
  sched: remove the 'u64 now' parameter from dequeue_task()
  sched: remove the 'u64 now' parameter from enqueue_task()
  sched: remove the 'u64 now' parameter from dec_nr_running()
  sched: remove the 'u64 now' parameter from inc_nr_running()
  sched: remove the 'u64 now' parameter from dec_load()
  sched: remove the 'u64 now' parameter from inc_load()
  sched: remove the 'u64 now' parameter from update_curr_load()
  sched: remove the 'u64 now' parameter from ->task_new()
  ...

16 years agolguest: avoid shared libraries mapped over guest memory
Ronald G. Minnich [Thu, 9 Aug 2007 11:07:24 +0000 (21:07 +1000)]
lguest: avoid shared libraries mapped over guest memory

Some versions of ld.so mmap the shared libraries right in over guest
memory, so compile lguest statically by default.

[ FC7 maps shared libraries very low, where the launcher maps guest's
  physical memory.  Quick fix is to link Launcher static, real fix is
  for 2.6.24. ]

-static is a simple fix. I expect this problem will be more common than we
like, as different distro's make different "improvements" to ld.so

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agolguest: Fix Malicious Guest GDT Host Crash
Rusty Russell [Thu, 9 Aug 2007 10:57:13 +0000 (20:57 +1000)]
lguest: Fix Malicious Guest GDT Host Crash

If a Guest makes hypercall which sets a GDT entry to not present, we
currently set any segment registers using that GDT entry to 0.
Unfortunately, this is not sufficient: there are other ways of
altering GDT entries which will cause a fault.

The correct solution to do what Linux does: let them set any GDT value
they want and handle the #GP when popping causes a fault.  This has
the added benefit of making our Switcher slightly more robust in the
case of any other bugs which cause it to fault.

We kill the Guest if it causes a fault in the Switcher: it's the
Guest's responsibility to make sure it's not using segments when it
changes them.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoFix non-TSC guest clocksource lockup
Rusty Russell [Thu, 9 Aug 2007 10:52:35 +0000 (20:52 +1000)]
Fix non-TSC guest clocksource lockup

lguest uses a host-supplied wallclock-based clocksource when the TSC
is not reliable.  As this is already in nanoseconds, I naively used a
multiplier of 1 and a shift of 0.

But update_wall_time() in its infinite wisdom decides to adjust the
clock a little (where does it think it's getting a more accurate time
from?)

It will happily tweak the multiplier... to 0, then -1.

So the "fix" is to use a shift of 22 like everyone else, and a
multiplier of 1 << 22.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoRevert "genirq: temporary fix for level-triggered IRQ resend"
Linus Torvalds [Thu, 9 Aug 2007 15:10:16 +0000 (08:10 -0700)]
Revert "genirq: temporary fix for level-triggered IRQ resend"

This reverts commit 0fc4969b866671dfe39b1a9119d0fdc7ea0f63e5.  It was
always meant to be temporary, but it's generating more useless noise
than anything else, and we probably should never have done it in the
generic kernel (only had the people involved test it on their own).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agommc: at91_mci: remove whitespace at the end of lines
Nicolas Ferre [Wed, 8 Aug 2007 10:01:44 +0000 (12:01 +0200)]
mmc: at91_mci: remove whitespace at the end of lines

Some cleanup with whitespace/tab at the end of lines.

Signed-off-by: Nicolas Ferre <nicolas.ferre@rfo.atmel.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
16 years agommc: reorganize bounce buffer init
Pierre Ossman [Thu, 9 Aug 2007 12:28:02 +0000 (14:28 +0200)]
mmc: reorganize bounce buffer init

Reorganize the code that initializes mmc_block's bounce buffer in
order to avoid warnings when MMC_BLOCK_BOUNCE isn't used.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
16 years agowbsd: fix section mismatch warnings
Gabriel C [Thu, 2 Aug 2007 18:20:44 +0000 (20:20 +0200)]
wbsd: fix section mismatch warnings

This patch fixes the following section mismatch warnings

...

WARNING: vmlinux.o(.init.text+0x29d40): Section mismatch: reference to .exit.text:wbsd_release_resources (between 'wbsd_init' and 'wbsd_probe')
WARNING: vmlinux.o(.init.text+0x29d49): Section mismatch: reference to .exit.text:wbsd_free_mmc (between 'wbsd_init' and 'wbsd_probe')
WARNING: vmlinux.o(.init.text+0x29f28): Section mismatch: reference to .exit.text:wbsd_free_mmc (between 'wbsd_init' and 'wbsd_probe')

...

Signed-off-by: Gabriel Craciunescu <nix.or.die@googlemail.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
16 years agosched: refine negative nice level granularity
Ingo Molnar [Thu, 9 Aug 2007 09:16:52 +0000 (11:16 +0200)]
sched: refine negative nice level granularity

refine the granularity of negative nice level tasks: let them
reschedule more often to offset the effect of them consuming
their wait_runtime proportionately slower. (This makes nice-0
task scheduling smoother in the presence of negatively
reniced tasks.)

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: fix update_stats_enqueue() reniced codepath
Ingo Molnar [Thu, 9 Aug 2007 09:16:52 +0000 (11:16 +0200)]
sched: fix update_stats_enqueue() reniced codepath

the key has to be rescaled to /weight even if it has a positive value.

(this change only affects the scheduling of reniced tasks)

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: round a bit better
Ingo Molnar [Thu, 9 Aug 2007 09:16:51 +0000 (11:16 +0200)]
sched: round a bit better

round a tiny bit better in high-frequency rescheduling scenarios,
by rounding around zero instead of rounding down.

(this is pretty theoretical though)

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: make the multiplication table more accurate
Ingo Molnar [Thu, 9 Aug 2007 09:16:51 +0000 (11:16 +0200)]
sched: make the multiplication table more accurate

do small deltas in the weight and multiplication constant table so
that the worst-case numeric error is better than 1:100000000. (8 digits)

the current error table is:

     nice       mult *   inv_mult   error
     ------------------------------------------
     -20:      88761 *      48388  -0.0000000065
     -19:      71755 *      59856  -0.0000000037
     -18:      56483 *      76040   0.0000000056
     -17:      46273 *      92818   0.0000000042
     -16:      36291 *     118348  -0.0000000065
     -15:      29154 *     147320  -0.0000000037
     -14:      23254 *     184698  -0.0000000009
     -13:      18705 *     229616  -0.0000000037
     -12:      14949 *     287308  -0.0000000009
     -11:      11916 *     360437  -0.0000000009
     -10:       9548 *     449829  -0.0000000009
      -9:       7620 *     563644  -0.0000000037
      -8:       6100 *     704093   0.0000000009
      -7:       4904 *     875809   0.0000000093
      -6:       3906 *    1099582  -0.0000000009
      -5:       3121 *    1376151  -0.0000000058
      -4:       2501 *    1717300   0.0000000009
      -3:       1991 *    2157191  -0.0000000035
      -2:       1586 *    2708050   0.0000000009
      -1:       1277 *    3363326   0.0000000014
       0:       1024 *    4194304   0.0000000000
       1:        820 *    5237765   0.0000000009
       2:        655 *    6557202   0.0000000033
       3:        526 *    8165337  -0.0000000079
       4:        423 *   10153587   0.0000000012
       5:        335 *   12820798   0.0000000079
       6:        272 *   15790321   0.0000000037
       7:        215 *   19976592  -0.0000000037
       8:        172 *   24970740  -0.0000000037
       9:        137 *   31350126  -0.0000000079
      10:        110 *   39045157  -0.0000000061
      11:         87 *   49367440  -0.0000000037
      12:         70 *   61356676   0.0000000056
      13:         56 *   76695844  -0.0000000075
      14:         45 *   95443717  -0.0000000072
      15:         36 *  119304647  -0.0000000009
      16:         29 *  148102320  -0.0000000037
      17:         23 *  186737708  -0.0000000028
      18:         18 *  238609294  -0.0000000009
      19:         15 *  286331153  -0.0000000002

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: optimize update_rq_clock() calls in the load-balancer
Ingo Molnar [Thu, 9 Aug 2007 09:16:51 +0000 (11:16 +0200)]
sched: optimize update_rq_clock() calls in the load-balancer

optimize update_rq_clock() calls in the load-balancer: update them
right after locking the runqueue(s) so that the pull functions do
not have to call it.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: optimize activate_task()
Ingo Molnar [Thu, 9 Aug 2007 09:16:51 +0000 (11:16 +0200)]
sched: optimize activate_task()

optimize activate_task() by removing update_rq_clock() from it.
(and add update_rq_clock() to all callsites of activate_task() that
did not have it before.)

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: clean up set_curr_task_fair()
Ingo Molnar [Thu, 9 Aug 2007 09:16:51 +0000 (11:16 +0200)]
sched: clean up set_curr_task_fair()

clean up set_curr_task_fair().

( identity transformation that causes no change in functionality. )

   text    data     bss     dec     hex filename
  39170    3750      36   42956    a7cc sched.o.before
  39170    3750      36   42956    a7cc sched.o.after

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: remove __update_rq_clock() call from entity_tick()
Ingo Molnar [Thu, 9 Aug 2007 09:16:51 +0000 (11:16 +0200)]
sched: remove __update_rq_clock() call from entity_tick()

remove __update_rq_clock() call from entity_tick().

no change in functionality because scheduler_tick() already calls
__update_rq_clock().

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: move the __update_rq_clock() call to scheduler_tick()
Ingo Molnar [Thu, 9 Aug 2007 09:16:51 +0000 (11:16 +0200)]
sched: move the __update_rq_clock() call to scheduler_tick()

move the __update_rq_clock() call from update_cpu_load() to
scheduler_tick().

( identity transformation that causes no change in functionality. )

this allows the direct use of rq->clock in ->task_tick() functions.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched debug: remove the 'u64 now' parameter from print_task()/_rq()
Ingo Molnar [Thu, 9 Aug 2007 09:16:51 +0000 (11:16 +0200)]
sched debug: remove the 'u64 now' parameter from print_task()/_rq()

remove the 'u64 now' parameter from sched_debug.c:print_task()/_rq().

( identity transformation that causes no change in functionality. )

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: remove the 'u64 now' local variables
Ingo Molnar [Thu, 9 Aug 2007 09:16:51 +0000 (11:16 +0200)]
sched: remove the 'u64 now' local variables

final step: remove all (now superfluous) 'u64 now' variables.

( identity transformation that causes no change in functionality. )

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: remove the 'u64 now' parameter from deactivate_task()
Ingo Molnar [Thu, 9 Aug 2007 09:16:49 +0000 (11:16 +0200)]
sched: remove the 'u64 now' parameter from deactivate_task()

remove the 'u64 now' parameter from deactivate_task().

( identity transformation that causes no change in functionality. )

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: remove the 'u64 now' parameter from dequeue_task()
Ingo Molnar [Thu, 9 Aug 2007 09:16:49 +0000 (11:16 +0200)]
sched: remove the 'u64 now' parameter from dequeue_task()

remove the 'u64 now' parameter from dequeue_task().

( identity transformation that causes no change in functionality. )

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: remove the 'u64 now' parameter from enqueue_task()
Ingo Molnar [Thu, 9 Aug 2007 09:16:49 +0000 (11:16 +0200)]
sched: remove the 'u64 now' parameter from enqueue_task()

remove the 'u64 now' parameter from enqueue_task().

( identity transformation that causes no change in functionality. )

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: remove the 'u64 now' parameter from dec_nr_running()
Ingo Molnar [Thu, 9 Aug 2007 09:16:49 +0000 (11:16 +0200)]
sched: remove the 'u64 now' parameter from dec_nr_running()

remove the 'u64 now' parameter from dec_nr_running().

( identity transformation that causes no change in functionality. )

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: remove the 'u64 now' parameter from inc_nr_running()
Ingo Molnar [Thu, 9 Aug 2007 09:16:49 +0000 (11:16 +0200)]
sched: remove the 'u64 now' parameter from inc_nr_running()

remove the 'u64 now' parameter from inc_nr_running().

( identity transformation that causes no change in functionality. )

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: remove the 'u64 now' parameter from dec_load()
Ingo Molnar [Thu, 9 Aug 2007 09:16:49 +0000 (11:16 +0200)]
sched: remove the 'u64 now' parameter from dec_load()

remove the 'u64 now' parameter from dec_load().

( identity transformation that causes no change in functionality. )

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: remove the 'u64 now' parameter from inc_load()
Ingo Molnar [Thu, 9 Aug 2007 09:16:49 +0000 (11:16 +0200)]
sched: remove the 'u64 now' parameter from inc_load()

remove the 'u64 now' parameter from inc_load().

( identity transformation that causes no change in functionality. )

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: remove the 'u64 now' parameter from update_curr_load()
Ingo Molnar [Thu, 9 Aug 2007 09:16:49 +0000 (11:16 +0200)]
sched: remove the 'u64 now' parameter from update_curr_load()

remove the 'u64 now' parameter from update_curr_load().

( identity transformation that causes no change in functionality. )

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: remove the 'u64 now' parameter from ->task_new()
Ingo Molnar [Thu, 9 Aug 2007 09:16:49 +0000 (11:16 +0200)]
sched: remove the 'u64 now' parameter from ->task_new()

remove the 'u64 now' parameter from ->task_new().

( identity transformation that causes no change in functionality. )

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: remove the 'u64 now' parameter from ->put_prev_task()
Ingo Molnar [Thu, 9 Aug 2007 09:16:49 +0000 (11:16 +0200)]
sched: remove the 'u64 now' parameter from ->put_prev_task()

remove the 'u64 now' parameter from ->put_prev_task().

( identity transformation that causes no change in functionality. )

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: remove the 'u64 now' parameter from pick_next_task()
Ingo Molnar [Thu, 9 Aug 2007 09:16:49 +0000 (11:16 +0200)]
sched: remove the 'u64 now' parameter from pick_next_task()

remove the 'u64 now' parameter from pick_next_task().

( identity transformation that causes no change in functionality. )

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: remove the 'u64 now' parameter from ->pick_next_task()
Ingo Molnar [Thu, 9 Aug 2007 09:16:48 +0000 (11:16 +0200)]
sched: remove the 'u64 now' parameter from ->pick_next_task()

remove the 'u64 now' parameter from ->pick_next_task().

( identity transformation that causes no change in functionality. )

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: remove the 'u64 now' parameter from ->dequeue_task()
Ingo Molnar [Thu, 9 Aug 2007 09:16:48 +0000 (11:16 +0200)]
sched: remove the 'u64 now' parameter from ->dequeue_task()

remove the 'u64 now' parameter from ->dequeue_task().

( identity transformation that causes no change in functionality. )

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: remove the 'u64 now' parameter from ->enqueue_task()
Ingo Molnar [Thu, 9 Aug 2007 09:16:48 +0000 (11:16 +0200)]
sched: remove the 'u64 now' parameter from ->enqueue_task()

remove the 'u64 now' parameter from ->enqueue_task().

( identity transformation that causes no change in functionality. )

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: remove the 'u64 now' parameter from update_curr_rt()
Ingo Molnar [Thu, 9 Aug 2007 09:16:48 +0000 (11:16 +0200)]
sched: remove the 'u64 now' parameter from update_curr_rt()

remove the 'u64 now' parameter from update_curr_rt().

( identity transformation that causes no change in functionality. )

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: remove the 'u64 now' parameter from put_prev_entity()
Ingo Molnar [Thu, 9 Aug 2007 09:16:48 +0000 (11:16 +0200)]
sched: remove the 'u64 now' parameter from put_prev_entity()

remove the 'u64 now' parameter from put_prev_entity().

( identity transformation that causes no change in functionality. )

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: remove the 'u64 now' parameter from pick_next_entity()
Ingo Molnar [Thu, 9 Aug 2007 09:16:48 +0000 (11:16 +0200)]
sched: remove the 'u64 now' parameter from pick_next_entity()

remove the 'u64 now' parameter from pick_next_entity().

( identity transformation that causes no change in functionality. )

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: remove the 'u64 now' parameter from set_next_entity()
Ingo Molnar [Thu, 9 Aug 2007 09:16:48 +0000 (11:16 +0200)]
sched: remove the 'u64 now' parameter from set_next_entity()

remove the 'u64 now' parameter from set_next_entity().

( identity transformation that causes no change in functionality. )

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: remove the 'u64 now' parameter from dequeue_entity()
Ingo Molnar [Thu, 9 Aug 2007 09:16:48 +0000 (11:16 +0200)]
sched: remove the 'u64 now' parameter from dequeue_entity()

remove the 'u64 now' parameter from dequeue_entity().

( identity transformation that causes no change in functionality. )

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: remove the 'u64 now' parameter from enqueue_entity()
Ingo Molnar [Thu, 9 Aug 2007 09:16:48 +0000 (11:16 +0200)]
sched: remove the 'u64 now' parameter from enqueue_entity()

remove the 'u64 now' parameter from enqueue_entity().

( identity transformation that causes no change in functionality. )

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: remove the 'u64 now' parameter from enqueue_sleeper()
Ingo Molnar [Thu, 9 Aug 2007 09:16:48 +0000 (11:16 +0200)]
sched: remove the 'u64 now' parameter from enqueue_sleeper()

remove the 'u64 now' parameter from enqueue_sleeper().

( identity transformation that causes no change in functionality. )

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: remove the 'u64 now' parameter from __enqueue_sleeper()
Ingo Molnar [Thu, 9 Aug 2007 09:16:48 +0000 (11:16 +0200)]
sched: remove the 'u64 now' parameter from __enqueue_sleeper()

remove the 'u64 now' parameter from __enqueue_sleeper().

( identity transformation that causes no change in functionality. )

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: remove the 'u64 now' parameter from update_stats_curr_end()
Ingo Molnar [Thu, 9 Aug 2007 09:16:48 +0000 (11:16 +0200)]
sched: remove the 'u64 now' parameter from update_stats_curr_end()

remove the 'u64 now' parameter from update_stats_curr_end().

( identity transformation that causes no change in functionality. )

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: remove the 'u64 now' parameter from update_stats_dequeue()
Ingo Molnar [Thu, 9 Aug 2007 09:16:48 +0000 (11:16 +0200)]
sched: remove the 'u64 now' parameter from update_stats_dequeue()

remove the 'u64 now' parameter from update_stats_dequeue().

( identity transformation that causes no change in functionality. )

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: remove the 'u64 now' parameter from update_stats_curr_start()
Ingo Molnar [Thu, 9 Aug 2007 09:16:47 +0000 (11:16 +0200)]
sched: remove the 'u64 now' parameter from update_stats_curr_start()

remove the 'u64 now' parameter from update_stats_curr_start().

( identity transformation that causes no change in functionality. )

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: remove the 'u64 now' parameter from update_stats_wait_end()
Ingo Molnar [Thu, 9 Aug 2007 09:16:47 +0000 (11:16 +0200)]
sched: remove the 'u64 now' parameter from update_stats_wait_end()

remove the 'u64 now' parameter from update_stats_wait_end().

( identity transformation that causes no change in functionality. )

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: remove the 'u64 now' parameter from __update_stats_wait_end()
Ingo Molnar [Thu, 9 Aug 2007 09:16:47 +0000 (11:16 +0200)]
sched: remove the 'u64 now' parameter from __update_stats_wait_end()

remove the 'u64 now' parameter from __update_stats_wait_end().

( identity transformation that causes no change in functionality. )

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: remove the 'u64 now' parameter from update_stats_enqueue()
Ingo Molnar [Thu, 9 Aug 2007 09:16:47 +0000 (11:16 +0200)]
sched: remove the 'u64 now' parameter from update_stats_enqueue()

remove the 'u64 now' parameter from update_stats_enqueue().

( identity transformation that causes no change in functionality. )

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: remove the 'u64 now' parameter from update_stats_wait_start()
Ingo Molnar [Thu, 9 Aug 2007 09:16:47 +0000 (11:16 +0200)]
sched: remove the 'u64 now' parameter from update_stats_wait_start()

remove the 'u64 now' parameter from update_stats_wait_start().

( identity transformation that causes no change in functionality. )

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: remove the 'u64 now' parameter from update_curr()
Ingo Molnar [Thu, 9 Aug 2007 09:16:47 +0000 (11:16 +0200)]
sched: remove the 'u64 now' parameter from update_curr()

remove the 'u64 now' parameter from update_curr().

( identity transformation that causes no change in functionality. )

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: remove the 'u64 now' parameter from print_cfs_rq()
Ingo Molnar [Thu, 9 Aug 2007 09:16:47 +0000 (11:16 +0200)]
sched: remove the 'u64 now' parameter from print_cfs_rq()

remove the 'u64 now' parameter from print_cfs_rq().

( identity transformation that causes no change in functionality. )

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: remove 'now' use from assignments
Ingo Molnar [Thu, 9 Aug 2007 09:16:47 +0000 (11:16 +0200)]
sched: remove 'now' use from assignments

change all 'now' timestamp uses in assignments to rq->clock.

( this is an identity transformation that causes no functionality change:
  all such new rq->clock is necessarily preceded by an update_rq_clock()
  call. )

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: remove __rq_clock()
Ingo Molnar [Thu, 9 Aug 2007 09:16:47 +0000 (11:16 +0200)]
sched: remove __rq_clock()

remove the (now unused) __rq_clock() function.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: eliminate __rq_clock() use
Ingo Molnar [Thu, 9 Aug 2007 09:16:47 +0000 (11:16 +0200)]
sched: eliminate __rq_clock() use

eliminate __rq_clock() use by changing it to:

   __update_rq_clock(rq)
   now = rq->clock;

identity transformation - no change in behavior.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: remove rq_clock()
Ingo Molnar [Thu, 9 Aug 2007 09:16:47 +0000 (11:16 +0200)]
sched: remove rq_clock()

remove the now unused rq_clock() function.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: eliminate rq_clock() use
Ingo Molnar [Thu, 9 Aug 2007 09:16:47 +0000 (11:16 +0200)]
sched: eliminate rq_clock() use

eliminate rq_clock() use by changing it to:

   update_rq_clock(rq)
   now = rq->clock;

identity transformation - no change in behavior.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: add [__]update_rq_clock(rq)
Ingo Molnar [Thu, 9 Aug 2007 09:16:46 +0000 (11:16 +0200)]
sched: add [__]update_rq_clock(rq)

add the [__]update_rq_clock(rq) functions. (No change in functionality,
just reorganization to prepare for elimination of the heavy 64-bit
timestamp-passing in the scheduler.)

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: fix bug in balance_tasks()
Peter Williams [Thu, 9 Aug 2007 09:16:46 +0000 (11:16 +0200)]
sched: fix bug in balance_tasks()

There are two problems with balance_tasks() and how it used:

1. The variables best_prio and best_prio_seen (inherited from the old
move_tasks()) were only required to handle problems caused by the
active/expired arrays, the order in which they were processed and the
possibility that the task with the highest priority could be on either.
  These issues are no longer present and the extra overhead associated
with their use is unnecessary (and possibly wrong).

2. In the absence of CONFIG_FAIR_GROUP_SCHED being set, the same
this_best_prio variable needs to be used by all scheduling classes or
there is a risk of moving too much load.  E.g. if the highest priority
task on this at the beginning is a fairly low priority task and the rt
class migrates a task (during its turn) then that moved task becomes the
new highest priority task on this_rq but when the sched_fair class
initializes its copy of this_best_prio it will get the priority of the
original highest priority task as, due to the run queue locks being
held, the reschedule triggered by pull_task() will not have taken place.
  This could result in inappropriate overriding of skip_for_load and
excessive load being moved.

The attached patch addresses these problems by deleting all reference to
best_prio and best_prio_seen and making this_best_prio a reference
parameter to the various functions involved.

load_balance_fair() has also been modified so that this_best_prio is
only reset (in the loop) if CONFIG_FAIR_GROUP_SCHED is set.  This should
preserve the effect of helping spread groups' higher priority tasks
around the available CPUs while improving system performance when
CONFIG_FAIR_GROUP_SCHED isn't set.

Signed-off-by: Peter Williams <pwil3058@bigpond.net.au>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: document nice levels
Ingo Molnar [Thu, 9 Aug 2007 09:16:46 +0000 (11:16 +0200)]
sched: document nice levels

Document the design thinking behind nice levels.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: remove binary sysctls from kernel.sched_domain
Alexey Dobriyan [Thu, 9 Aug 2007 09:16:46 +0000 (11:16 +0200)]
sched: remove binary sysctls from kernel.sched_domain

kernel.sched_domain hierarchy is under CTL_UNNUMBERED and thus
unreachable to sysctl(2). Generating .ctl_number's in such situation is
not useful.

Signed-off-by: Alexey Dobriyan <adobriyan@sw.ru>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: delta_exec accounting fix
Ingo Molnar [Thu, 9 Aug 2007 09:16:46 +0000 (11:16 +0200)]
sched: delta_exec accounting fix

small delta_exec accounting fix: increase delta_exec and increase
sum_exec_runtime even if the task is not on the runqueue anymore.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: clean up delta_mine
Ingo Molnar [Thu, 9 Aug 2007 09:16:46 +0000 (11:16 +0200)]
sched: clean up delta_mine

cleanup: delta_mine is an unsigned value.

no code impact:

   text    data     bss     dec     hex filename
   27823    2726      16   30565    7765 sched.o.before
   27823    2726      16   30565    7765 sched.o.after

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: schedule() speedup
Ingo Molnar [Thu, 9 Aug 2007 09:16:46 +0000 (11:16 +0200)]
sched: schedule() speedup

speed up schedule(): share the 'now' parameter that deactivate_task()
was calculating internally.

( this also fixes the small accounting window between the deactivate
  call and the pick_next_task() call. )

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: uninline rq_clock()
Ingo Molnar [Thu, 9 Aug 2007 09:16:46 +0000 (11:16 +0200)]
sched: uninline rq_clock()

uninline rq_clock() to save 263 bytes of code:

   text    data     bss     dec     hex filename
   39561    3642      24   43227    a8db sched.o.before
   39298    3642      24   42964    a7d4 sched.o.after

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: mark print_cfs_stats static
Josh Triplett [Thu, 9 Aug 2007 09:16:46 +0000 (11:16 +0200)]
sched: mark print_cfs_stats static

sched_fair.c defines print_cfs_stats, and sched_debug.c uses it, but sched.c
includes both sched_fair.c and sched_debug.c, so all the references to
print_cfs_stats occur in the same compilation unit.  Thus, mark
print_cfs_stats static.

Eliminates a sparse warning:
warning: symbol 'print_cfs_stats' was not declared. Should it be static?

Signed-off-by: Josh Triplett <josh@kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: clean up sched_getaffinity()
Ulrich Drepper [Thu, 9 Aug 2007 09:16:46 +0000 (11:16 +0200)]
sched: clean up sched_getaffinity()

here's another tiny cleanup.  The generated code is not affected (gcc is
smart enough) but for people looking over the code it is just irritating
to have the extra conditional.

Signed-off-by: Ulrich Drepper <drepper@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: mention CONFIG_SCHED_DEBUG in documentation
Thomas Voegtle [Thu, 9 Aug 2007 09:16:46 +0000 (11:16 +0200)]
sched: mention CONFIG_SCHED_DEBUG in documentation

a little hint to switch on CONFIG_SCHED_DEBUG should be given.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: simplify move_tasks()
Peter Williams [Thu, 9 Aug 2007 09:16:46 +0000 (11:16 +0200)]
sched: simplify move_tasks()

The move_tasks() function is currently multiplexed with two distinct
capabilities:

1. attempt to move a specified amount of weighted load from one run
queue to another; and
2. attempt to move a specified number of tasks from one run queue to
another.

The first of these capabilities is used in two places, load_balance()
and load_balance_idle(), and in both of these cases the return value of
move_tasks() is used purely to decide if tasks/load were moved and no
notice of the actual number of tasks moved is taken.

The second capability is used in exactly one place,
active_load_balance(), to attempt to move exactly one task and, as
before, the return value is only used as an indicator of success or failure.

This multiplexing of sched_task() was introduced, by me, as part of the
smpnice patches and was motivated by the fact that the alternative, one
function to move specified load and one to move a single task, would
have led to two functions of roughly the same complexity as the old
move_tasks() (or the new balance_tasks()).  However, the new modular
design of the new CFS scheduler allows a simpler solution to be adopted
and this patch addresses that solution by:

1. adding a new function, move_one_task(), to be used by
active_load_balance(); and
2. making move_tasks() a single purpose function that tries to move a
specified weighted load and returns 1 for success and 0 for failure.

One of the consequences of these changes is that neither move_one_task()
or the new move_tasks() care how many tasks sched_class.load_balance()
moves and this enables its interface to be simplified by returning the
amount of load moved as its result and removing the load_moved pointer
from the argument list.  This helps simplify the new move_tasks() and
slightly reduces the amount of work done in each of
sched_class.load_balance()'s implementations.

Further simplification, e.g. changes to balance_tasks(), are possible
but (slightly) complicated by the special needs of load_balance_fair()
so I've left them to a later patch (if this one gets accepted).

NB Since move_tasks() gets called with two run queue locks held even
small reductions in overhead are worthwhile.

[ mingo@elte.hu ]

this change also reduces code size nicely:

   text    data     bss     dec     hex filename
   39216    3618      24   42858    a76a sched.o.before
   39173    3618      24   42815    a73f sched.o.after

Signed-off-by: Peter Williams <pwil3058@bigpond.net.au>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: reorder update_cpu_load(rq) with the ->task_tick() call
Ingo Molnar [Thu, 9 Aug 2007 09:16:45 +0000 (11:16 +0200)]
sched: reorder update_cpu_load(rq) with the ->task_tick() call

Peter Williams suggested to flip the order of update_cpu_load(rq) with
the ->task_tick() call. This is a NOP for the current scheduler (the
two functions are independent of each other), ->task_tick() might
create some state for update_cpu_load() in the future (or in PlugSched).

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosched: batch sleeper bonus
Ingo Molnar [Thu, 9 Aug 2007 09:16:45 +0000 (11:16 +0200)]
sched: batch sleeper bonus

batch up the sleeper bonus sum a bit more. Anything below
sched-granularity is too small to make a practical difference
anyway.

this optimization reduces the math in high-frequency scheduling
scenarios.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years ago[SPARC64]: Fix memory leak when cpu hotplugging.
David S. Miller [Thu, 9 Aug 2007 00:32:33 +0000 (17:32 -0700)]
[SPARC64]: Fix memory leak when cpu hotplugging.

Every time a cpu is added via hotplug, we allocate the per-cpu MONDO
queues but we never free them up.  Freeing isn't easy since the first
cpu gets this memory from bootmem.

Therefore, the simplest thing to do to fix this bug is to allocate the
queues for all possible cpus at boot time.

Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[SPARC64]: Do not assume sun4v chips have load-twin/store-init support.
David S. Miller [Thu, 9 Aug 2007 00:11:39 +0000 (17:11 -0700)]
[SPARC64]: Do not assume sun4v chips have load-twin/store-init support.

Check the cpu type in the OBP device tree before committing to
using the optimized Niagara memcpy and memset implementation.

If we don't recognize the cpu type, use a completely generic
version.

Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agofix oops in __audit_signal_info()
Al Viro [Tue, 7 Aug 2007 23:01:46 +0000 (00:01 +0100)]
fix oops in __audit_signal_info()

The check for audit_signals is misplaced and the check for
audit_dummy_context() is missing; as the result, if we send a signal to
auditd from task with NULL ->audit_context while we have audit_signals
!= 0 we end up with an oops.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Acked-by: James Morris <jmorris@namei.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years ago[SPARC64]: Fix hard-coding of cpu type output in /proc/cpuinfo on sun4v.
David S. Miller [Wed, 8 Aug 2007 02:09:29 +0000 (19:09 -0700)]
[SPARC64]: Fix hard-coding of cpu type output in /proc/cpuinfo on sun4v.

Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[SPARC]: Centralize find_in_proplist() instead of duplicating N times.
David S. Miller [Wed, 8 Aug 2007 01:46:36 +0000 (18:46 -0700)]
[SPARC]: Centralize find_in_proplist() instead of duplicating N times.

Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[TCP]: H-TCP maxRTT estimation at startup
Stephen Hemminger [Wed, 8 Aug 2007 01:29:05 +0000 (18:29 -0700)]
[TCP]: H-TCP maxRTT estimation at startup

Small patch to H-TCP from Douglas Leith.

Fix estimation of maxRTT.  The original code ignores rtt measurements
during slow start (via the check tp->snd_ssthresh < 0xFFFF) yet this
is probably a good time to try to estimate max rtt as delayed acking
is disabled and slow start will only exit on a loss which presumably
corresponds to a maxrtt measurement.  Second, the original code (via
the check htcp_ccount(ca) > 3) ignores rtt data during what it
estimates to be the first 3 round-trip times.  This seems like an
unnecessary check now that the RCV timestamp are no longer used
for rtt estimation.

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[NETFILTER]: nf_nat: add symbolic dependency on IPv4 conntrack
Patrick McHardy [Wed, 8 Aug 2007 01:12:01 +0000 (18:12 -0700)]
[NETFILTER]: nf_nat: add symbolic dependency on IPv4 conntrack

Loading nf_nat causes the conntrack core to be loaded, but we need IPv4 as
well.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[NETFILTER]: ctnetlink: return EEXIST instead of EINVAL for existing nat'ed conntracks
Pablo Neira Ayuso [Wed, 8 Aug 2007 01:11:26 +0000 (18:11 -0700)]
[NETFILTER]: ctnetlink: return EEXIST instead of EINVAL for existing nat'ed conntracks

ctnetlink must return EEXIST for existing nat'ed conntracks instead of
EINVAL. Only return EINVAL if we try to update a conntrack with NAT
handlings (that is not allowed).

Decadence:libnetfilter_conntrack/utils# ./conntrack_create_nat
TEST: create conntrack (0)(Success)
Decadence:libnetfilter_conntrack/utils# ./conntrack_create_nat
TEST: create conntrack (-1)(Invalid argument)

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[NETFILTER]: ipt_recent: avoid a possible NULL pointer deref in recent_seq_open()
Jesper Juhl [Wed, 8 Aug 2007 01:10:54 +0000 (18:10 -0700)]
[NETFILTER]: ipt_recent: avoid a possible NULL pointer deref in recent_seq_open()

If the call to seq_open() returns != 0 then the code calls
kfree(st) but then on the very next line proceeds to
dereference the pointer - not good.

Problem spotted by the Coverity checker.

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agoMerge branch 'fixes-davem' of master.kernel.org:/pub/scm/linux/kernel/git/linville...
David S. Miller [Wed, 8 Aug 2007 01:07:35 +0000 (18:07 -0700)]
Merge branch 'fixes-davem' of /linux/kernel/git/linville/wireless-2.6

16 years ago[NET] net/core/utils: fix sparse warning
Johannes Berg [Wed, 8 Aug 2007 01:02:43 +0000 (18:02 -0700)]
[NET] net/core/utils: fix sparse warning

net_msg_warn is not defined because it is in net/sock.h which isn't
included.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years ago[NetLabel]: add missing rcu_dereference() calls in the LSM domain mapping hash table
Paul Moore [Wed, 8 Aug 2007 00:53:10 +0000 (17:53 -0700)]
[NetLabel]: add missing rcu_dereference() calls in the LSM domain mapping hash table
The LSM domain mapping head table pointer was not being referenced via the RCU
safe dereferencing function, rcu_dereference().  This patch adds those missing
calls to the NetLabel code.

This has been tested using recent linux-2.6 git kernels with no visible
regressions.

Signed-off-by: Paul Moore <paul.moore@hp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agodrivers/net/ibmveth.c: memset fix
Mariusz Kozlowski [Mon, 6 Aug 2007 21:44:03 +0000 (23:44 +0200)]
drivers/net/ibmveth.c: memset fix

> >>  Looks like memset() is zeroing wrong nr of bytes.
> >
> > Good catch, however, I think we can just remove this memset altogether
> > since the memory gets allocated via kzalloc.
>
> Correct, that memset() is superfluous.

Ok. Then this should do it.

Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
 drivers/net/ibmveth.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
Signed-off-by: Jeff Garzik <jeff@garzik.org>
16 years agophy layer: fix phy_mii_ioctl for autonegotiation
Domen Puncer [Tue, 7 Aug 2007 10:12:41 +0000 (12:12 +0200)]
phy layer: fix phy_mii_ioctl for autonegotiation

Fix a thinko (?) in setting phydev->autoneg.

Signed-off-by: Domen Puncer <domen.puncer@telargo.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
16 years agoehea: Eliminated some compiler warnings
Thomas Klein [Mon, 6 Aug 2007 11:55:44 +0000 (13:55 +0200)]
ehea: Eliminated some compiler warnings

Fixed wrongly casted pointers

Signed-off-by: Thomas Klein <tklein@de.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>