[PATCH] make console_conditional_schedule() __sched and use cond_resched()
Relatively minor add-on (not necessarily tied to it or required to be taken
or a fix for any bug). Since cond_resched() is using PREEMPT_ACTIVE now,
it may be useful to update the open-coded instance of cond_resched() to use
the generic call. Also, it should probably be __sched so the caller shows
up in wchan.
Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
[PATCH] Incorrect PCI interrupt assignment on ES7000 for platform GSI
In arch/i386/kernel/acpi/boot.c, platform GSI does not propagate back from
mp_register_gsi() to a calling routine which results in IRQ to be set for
wrong GSI. This causes most of the PCI slots on the first PCI module to
fail. This patch fixes the problem by returning new GSI back to
acpi_register_gsi().
Ian Kent [Tue, 19 Oct 2004 01:11:20 +0000 (18:11 -0700)]
[PATCH] autofs4: allow map update recognition
Having recently repaired autofs' ability to recognise updates to maps
dynamically I found I needed to reintroduce the directory inode lookup
method (I broke the update recognition several versions ago, oops).
This patch does this and applies cleanly against 2.6.9-rc1-mm4.
As far as I can tell from testing it doesn't introduce any backward
incompatibilities.
Signed-off-by: Ian Kent <raven@themaw.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Zwane Mwaikambo [Tue, 19 Oct 2004 01:11:08 +0000 (18:11 -0700)]
[PATCH] Allow multiple inputs in alternative_input
I had to use the following patch to allow multiple arguments to be passed
down to the asm stub for alternative_input whilst writing alternatives for
mwait code, it seems like a simple enough fix.
Signed-off-by: Zwane Mwaikambo <zwane@linuxpower.ca> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
[PATCH] pidhashing: enforce PID_MAX_LIMIT in sysctls
The pid_max sysctl doesn't enforce PID_MAX_LIMIT or sane lower bounds.
RESERVED_PIDS + 1 is the minimum pid_max that won't break alloc_pidmap(), and
PID_MAX_LIMIT may not be aligned to 8*PAGE_SIZE boundaries for unusual values
of PAGE_SIZE, so this also rounds up PID_MAX_LIMIT to it.
Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
I was informed that the vendor component of the copyright can't be clobbered
without more care, so this patch retains the older vendor, updating it only to
reflect the appropriate time period.
Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Rewrite alloc_pidmap() to clarify control flow by eliminating all usage of
goto, honor pid_max and first available pid after last_pid semantics, make
only a single pass over the used portion of the pid bitmap, and update
copyrights to reflect ongoing maintenance by Ingo and myself.
Signed-off-by: William Irwin <wli@holomorphy.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Petr Vandrovec [Tue, 19 Oct 2004 01:09:53 +0000 (18:09 -0700)]
[PATCH] Add VIDIOC_S_CTRL_OLD to matroxfb
For several months I'm receiving complaints from matroxfb users that v4lctl
suddenly stops working for them on kernel upgrade.
Problem is that VIDIOC_S_CTRL was renumbered, but all distros still use old
VIDIOC_S_CTRL value (f.e. even xawtv-3.94 in Debian unstable still uses
old VIDIOC_S_CTRL definition).
So let's add this old VIDIOC_S_CTRL value (now named VIDIOC_S_CTRL_OLD) to
matroxfb's v4l handling.
Signed-off-by: Petr Vandrovec <vandrove@vc.cvut.cz> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This patch cleans up some old cruft in the manipulation of the LVDS
interface registers and fixes the blanking code to work with various DVI
flat panels.
Since this is all very sensitive stuff, I'm posting the patch here for
testing before submitting it upstream, though Andrew is welcome to put it
in -mm.
It also fix some problems with getting the right PLL setup on recent Mac
laptops, replacing the old hard coded list of values with cleaner code that
"probes" the PLL setup done by the firmware.
Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Petr Vandrovec [Tue, 19 Oct 2004 01:08:53 +0000 (18:08 -0700)]
[PATCH] Remove big-endian mode from matroxfb
One of the PowerPC developers, Kostas Georgiou, pointed out to me
discussion back from 2001 that they would prefer little endian mode as
majority of users runs XF4.x and not Xpmac. And apparently nobody runs
Xpmac now, so we can safely remove big-endian mode from matroxfb
completely.
So let's simplify matroxfb a bit:
Accelerator and ILOAD fifo is now always in little endian mode. This is
what XFree does. Due to this change all #ifdefs based on endianness was
removed from driver - except one which selects framebuffer endinaness (but
there is no code in matroxfb which writes to framebuffer directly).
It seems that while I was not looking m68k got ioremap, and all
architectures now offer ioremap and ioremap_nocache. Let's kill code which
mapped ioremap_nocache to ioremap, and ioremap to bus_to_virt for
architectures which did not provide them.
And this also fixes small typo - M_C2CTL should be 0x3C10 and not 0x3E10.
Apparently Matrox notes about need to program this register during
initialization are not so important...
Signed-off-by: Petr Vandrovec <vandrove@vc.cvut.cz> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Antonino Daplas [Tue, 19 Oct 2004 01:08:40 +0000 (18:08 -0700)]
[PATCH] fbdev: split vesafb option vram into vtotal and vremap
From: Gerd Knorr <kraxel@bytesex.org>:
"IMHO the the only sane thing is to have two options for total + remapped
memory as well. Otherwise we'll end up changing that back and forth like
it happened for the size calculation stuff for quite some time ...
The patch below does just that and also has the other vmode fix
(vmode = yres * linelength /* instead of yres * xres * depth >> 3 */)."
EDID_INFO is encroaching on the space meant for E820 map in zero-page.
This will result in E820 map corruption on any system that has more=20 than
18 E820 entries and CONFIG_VIDEO_SELECT. Not sure how this bug=20 managed
to hide for more than a year.
Attached patch should fix the bug.
Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Antonino Daplas [Tue, 19 Oct 2004 01:08:05 +0000 (18:08 -0700)]
[PATCH] fbcon unimap fix
fbcon doesn't set a unimap at boot time, so special characters come out
wrongly.
This is the code sequence in take_over_console().
newcon->startup()
oldcon->deinit()
newcon->init()
The previous console driver (ie, vgacon), via its deinit method, may release
the unimap allocated by fbcon in fbcon_startup. This is the reason why
calling con_set_default_unimap() in fbcon_init() works, but not in
fbcon_startup().
Check if the default display has an allocated unimap, and if it has none,
call con_set_default_unimap(). And if the target display has no allocated
unimap, then call con_copy_unimap(), where the source unimap is from the
default display.
Takashi Iwai [Tue, 19 Oct 2004 01:07:53 +0000 (18:07 -0700)]
[PATCH] VGA console font problems on 2.6 kernel
From: Egbert Eich <eich@suse.de>
I would like to utilize kernel ioctls to save/restore console fonts
in VGA text mode when running X. So far the Xserver takes care of this
however there more and more problems with this:
1. On some platforms (IA64) we need to POST the BIOS before
we even have a chance to access the hardware ourselves.
This POSTing will usually undo any changes to the graphics
hardware that the kernel may have done.
2. More and more drivers fully rely on BIOS support however
the BIOS functions which could be used to save/restore
register settings may be broken so the only way of mode
save/restore is getting/setting the BIOS mode ID.
I've hacked up some code for X however I ran into two problems:
1. con_font_get() in linux/drivers/char/vt.c seems to be broken as
the font parameters (height, width, charcount) are never reported
back. Therefore this function seems to be pretty useless.
The fix is simple (please see below).
2. fb consoles seem to allow to install fonts per vt so that the user
can have a different font on every console. The text console driver
doesn't support this: the font is downloaded to the video card
and will be used for all systems. Still the vga_con driver stores
the font parameters per console with the effect that setting a
font with different parameters on one console will result in the
wron values when this font information is read back from another
console.
Appearantly this broken feature has been introduced in 2.6 as
in the 2.4 kernel the vga_con font information is stored in one
single global variable.
The IA64 platform at least still heavily relies on the VGA text console.
To be able to fix some VT switching issues with X on this platform I
need these two issues resolved.
Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
When Antonino A. Daplas posted his "fbdev: Initialize i810fb after
agpgart" patch he said that the ugly agp initialization hack for intel agp
shouldn't be needed but that he couldn't test it.
I have tested the framebuffer updates and additionally removed the
initialization hack and it does indeed work.
Signed-off-by: Andreas Henriksson <andreas@fjortis.info> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Antonino Daplas [Tue, 19 Oct 2004 01:06:28 +0000 (18:06 -0700)]
[PATCH] fbdev: Add Tile Blitting support
Hopefully, this patch fixes one last major regression for one particular
driver, namely matroxfb. This drier has 2 versions, one for the kernel and
another as a '2.4 backport' patch.
This patch adds a tileblitting extension to fbcon. This extension, in
summary, is basically a forward-port of the 2.4 fbdev/fbcon framework to 2.6
but without the fbcon dependency. Tile blitting is similar to bitblit, except
that the basic unit is a tile (a bitmap of x-by-y dimensions). The display,
instead of being described in terms of pixels and scanlines, are described as
a region further subdivided into rectangular sections. In fbcon parlance, a
tile is a character.
Besides a possible fix for matroxfb, tileblitting can be advantageous for
hardware that supports some kind of fontcaching mechanism. Also, in the
unlikely chance that the console begins supporting multicolored fonts,
tileblitting is probably more optimal than bitblitting because bitblitting
will need to push more data through the bus.
To enable support for this extension, a driver needs to:
- enable CONFIG_FB_TILEBLITTING
- set FBINFO_MISC_TILEBLITTING in info->flags
- set the required function pointers in struct fb_tileops. The required
operations are:
Addition of this extension necessitates cleanup of fbcon.c. The basic drawing
functions in fbcon are bmove, clear, putcs and cursor (the fbcon_* set). The
fbcon_* set are just wrappers to accel_* set. However, usage is not
consistent, some functions call the fbcon_* set, others call the accel_* set.
With this patch, a new fbcon-specific structure (struct fbcon_ops) is created.
Depending on the setting of the hardware, this struct contains pointers to
either the tileblitting set or the bitblitting set (formerly the accel_* set).
The tileblitting set is new in this patch.
The vast majority of functions in fbcon will need to only call the fbcon_*
set. In turn, it calls functions in struct fbcon_ops. Knowledge of the
blitting type is not required.
The accel_* set is renamed to bit_* and is moved into a separate file,
bitblit.c. The tile blitting set is in tileblit.c.
In my case at least, the cleanup did produce an unexpected but beneficial
side effect, a little more speedup. Not much, < 5%.
Petr, if you have comments, suggestions, or you think this is a bad idea,
let me know.
Antonino Daplas [Tue, 19 Oct 2004 01:06:15 +0000 (18:06 -0700)]
[PATCH] fbdev: Pass struct device to class_simple_device_add
Swsusp turns off the display when a power-management-enabled framebuffer
driver is used. According to Nigel Cunningham <ncunningham@linuxmail.org>,
the fix may involve the following:
"...I thought the best approach would be to use device classes to find the
struct dev for the frame buffer driver, and then use the same code I use for
storage devices to avoid suspending the frame buffer until later..."
Changes:
- pass info->device to class_simple_device_add()
- add struct device *device to struct fb_info
- store struct device in framebuffer_alloc()
- for drivers not using framebuffer_alloc(), store the struct during
initalization
- port i810fb and rivafb to use framebuffer_alloc()
Antonino Daplas [Tue, 19 Oct 2004 01:06:02 +0000 (18:06 -0700)]
[PATCH] fbcon: Fix setup boot options of fbcon
This patch fixes the 'fbcon=map:<option>" of fbcon. (This option has been
present since 2.4, but got broken in 2.6). This particular option tells
fbcon what framebuffer device gets mapped to what console. Syntax is:
fbcon=map:abcd...
where a, b, c, d,... are framebuffer numbers as it would
appear in /proc/fb.
Given only 2 valid fbdevs, 0 and 1, if fbcon=map:0110, then:
tty1 = fb0
tty2 = fb1
tty3 = fb1
tty4 = fb0
(sequence repeats for the rest of the consoles)
If an invalid framebuffer is used, then the console will be mapped to the
first user-chosen framebuffer. Ie: fbcon=map:102
Antonino Daplas [Tue, 19 Oct 2004 01:05:38 +0000 (18:05 -0700)]
[PATCH] fbdev: remove unnecessary banshee_wait_idle from tdfxfb
- This patch removes the unnecessary call to banshee_wait_idle() from
tdfxfb_copyarea, imageblit and fillrect. Removal of the sync will garner
an additional ~20% in scrolling speed.
- Removes "inverse" which generates a compile warning if modular.
Marcelo Tosatti [Tue, 19 Oct 2004 01:05:25 +0000 (18:05 -0700)]
[PATCH] Adjust alignment of pagevec structure
We can shrink the pagevec structure to cacheline align it. It is used all
over VM reclaiming and mpage pagecache read code.
Right now it is 140 bytes on 64-bit and 72 bytes on 32-bit. Thats just a
little bit more than a power of 2 (which will cacheline align), so shrink
it to be aligned: 64 bytes on 32bit and 124bytes on 64-bit.
It now occupies two cachelines most of the time instead of three.
I changed nr and cold to "unsigned short" because they'll never reach 2 ^ 16.
Did some reaim benchmarking on 4way PIII (32byte cacheline), with 512MB RAM:
#### stock 2.6.9-rc1-mm4 ####
Peak load Test: Maximum Jobs per Minute 4144.44 (average of 3 runs)
Quick Convergence Test: Maximum Jobs per Minute 4007.86 (average of 3 runs)
Peak load Test: Maximum Jobs per Minute 4207.48 (average of 3 runs)
Quick Convergence Test: Maximum Jobs per Minute 3999.28 (average of 3 runs)
#### shrink-pagevec #####
Peak load Test: Maximum Jobs per Minute 4717.88 (average of 3 runs)
Quick Convergence Test: Maximum Jobs per Minute 4360.59 (average of 3 runs)
Peak load Test: Maximum Jobs per Minute 4493.18 (average of 3 runs)
Quick Convergence Test: Maximum Jobs per Minute 4327.77 (average of 3 runs)
Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Currently we every filesystem with Posix ACLs has it's own reimplemtation
of the generic permission checking code with additonal ACL support. This
patch
- adds an optional callback to vfs_permission that filesystems can use
for ACL support (and renames it to generic_permission because the old
name was wrong - it wasn't like the other vfs_* functions at all)
- uses it in ext2, ext3 and jfs. XFS will follow a little later as it's
permission checking is burried under several layers of abstraction.
From: Dave Kleikamp <shaggy@austin.ibm.com>
jfs doesn't currently set MS_POSIXACL (it doesn't require the acl mount
option), so this test would fail here. The patch below will set it.
Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Jens Axboe [Tue, 19 Oct 2004 01:01:41 +0000 (18:01 -0700)]
[PATCH] cfq-v2 I/O scheduler update
Here is the next incarnation of the CFQ io scheduler, so far known as
CFQ v2 locally. It attempts to address some of the limitations of the
original CFQ io scheduler (hence forth known as CFQ v1). Some of the
problems with CFQ v1 are:
- It does accounting for the lifetime of the cfq_queue, which is setup
and torn down for the time when a process has io in flight. For a fork
heavy work load (such as a kernel compile, for instance), new
processes can effectively starve io of running processes. This is in
part due to the fact that CFQ v1 gives preference to a new processes
to get better latency numbers. Removing that heuristic is not an
option exactly because of that.
- It makes no attempts to address inter-cfq_queue fairness.
- It makes no attempt to limit upper latency bound of a single request.
- It only provides per-tgid grouping. You need to change the source to
group on a different criteria.
- It uses a mempool for the cfq_queues. Theoretically this could
deadlock if io bound processes never exit.
- The may_queue() logic can be unfair since it fluctuates quickly, thus
leaving processes sleeping while new processes are allowed to allocate
a request.
CFQ v2 attempts to fix these issues. It uses the process io_context
logic to maintain a cfq_queue lifetime of the duration of the process
(and its io). This means we can now be a lot more clever in deciding
which process is allowed to queue or dispatch io to the device. The
cfq_io_context is per-process per-queue, this is an extension to what AS
currently does in that we truly do have a unique per-process identifier
for io grouping. Busy queues are sorted by service time used, sub sorted
by in_flight requests. Queues that have no io in flight are also
preferred at dispatch time.
Accounting is done on completion time of a request, or with a fixed cost
for tagged command queueing. Requests are fifo'ed like with deadline, to
make sure that a single request doesn't stay in the io scheduler for
ages.
Process grouping is selectable at runtime. I provide 4 grouping
criterias: process group, thread group id, user id, and group id.
As usual, settings are sysfs tweakable in /sys/block/<dev>/queue/iosched
back_seek_max
back_seek_penalty:
Useful logic stolen from AS that allow small backwards seeks in
the io stream if we deem them useful. CFQ uses a strict
ascending elevator otherwise. _max controls the maximum allowed
backwards seek, defaulting to 16MiB. _penalty denotes how
expensive we account a backwards seek compared to a forward
seek. Default is 2, meaning it's twice as expensive.
clear_elapsed:
Really a debug switch, will go away in the future. It clears the
maximum values for completion and dispatch time, shown in
show_status.
fifo_batch_expire
fifo_batch_async
fifo_batch_sync:
The settings for the expiry fifo. batch_expire is how often we
allow the fifo expire to control which request to select.
Default is 125ms. _async is the deadline for async requests
(typically writes), _sync is the deadline for sync requests
(reads and sync writes). Defaults are, respectively, 5 seconds
and 0.5 seconds.
key_type:
The grouping key. Can be set to pgid, tgid, uid, or gid. The
current value is shown bracketed:
Default is tgid. To set, simply echo any of the 4 words into the
file.
quantum:
The amount of requests we select for dispatch when the driver
asks for work to do and the current pending list is empty.
Default is 4.
queued:
The minimum amount of requests a group is allowed to queue.
Default is 8.
show_status:
Debug output showing the current state of the queues.
tagged:
Set this to 1 if the device is using tagged command queueing.
This cannot be reliably detected by CFQ yet, since most drivers
don't use the block layer (well it could, by looking at number
of requests being between dispatch and completion. but not
completely reliably). Default is 0.
The patch is a little big, but works reliably here on my laptop. There
are a number of other changes and fixes in there (like converting to
hlist for hashes). The code is commented a lot better, CFQ v1 has
basically no comments (reflecting that it was writting in one go, no
touched or tuned much since then). This is of course only done to
increase the AAF, akpm acceptance factor. Since I'm on the road, I
cannot provide any really good numbers of CFQ v1 compared to v2, maybe
someone will help me out there.
Jens Axboe [Tue, 19 Oct 2004 01:01:28 +0000 (18:01 -0700)]
[PATCH] switchable and modular io schedulers
This patch modularizes the io schedulers completely, allowing them to be
modular. Additionally it enables online switching of io schedulers. See
also http://lwn.net/Articles/102593/ .
There's a scheduler file in the sysfs directory for the block device
queue:
axboe@router:/sys/block/hda/queue> ls
iosched max_sectors_kb read_ahead_kb
max_hw_sectors_kb nr_requests scheduler
If you list the contents of the file, it will show available schedulers
and the active one:
Andrew Morton [Tue, 19 Oct 2004 01:01:03 +0000 (18:01 -0700)]
[PATCH] jbd wakeup fix
Processes can sleep in do_get_write_access(), waiting for buffers to be
removed from the BJ_Shadow state. We did this by doing a wake_up_buffer() in
the commit path and sleeping on the buffer in do_get_write_access().
With the filtered bit-level wakeup code this doesn't work properly any more -
the wake_up_buffer() accidentally wakes up tasks which are sleeping in
lock_buffer() as well. Those tasks now implicitly assume that the buffer came
unlocked. Net effect: Bogus I/O errors when reading journal blocks, because
the buffer isn't up to date yet. Hence the recently spate of journal_bmap()
failure reports.
The patch creates a new jbd-private BH flag purely for this wakeup function.
So a wake_up_bit(..., BH_Unshadow) doesn't wake up someone who is waiting for
a wake_up_bit(BH_Lock).
JBD was the only user of wake_up_buffer(), so remove it altogether.
Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
[PATCH] reduce number of parameters to __wait_on_bit() and __wait_on_bit_lock()
Some of the parameters to __wait_on_bit() and __wait_on_bit_lock() are
redundant, as the wait_bit_queue parameter holds the flags word and the bit
number. This patch updates __wait_on_bit() and __wait_on_bit_lock() to
fetch that information from the wait_bit_queue passed to them and so reduce
the number of parameters so that -mregparm may be more effective.
Incremental atop the complete out-of-lining of the contention cases and the
fastcall and wait_on_bit_lock()/test_and_set_bit() fixes.
Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
[PATCH] move wait ops' contention case completely out of line
Move the slow paths of wait_on_bit() and wait_on_bit_lock() out of line.
Also uninline wake_up_bit() to reduce the number of callsites generated,
and adjust loop startup in __wait_on_bit_lock() to properly reflect its
usage in the contention case.
Incremental atop the fastcall and wait_on_bit_lock()/test_and_set_bit()
fixes. Successfully tested on x86-64.
Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Eliminate specialized page and bh waitqueue hashing structures in favor of
a standardized structure, using wake_up_bit() to wake waiters using the
standardized wait_bit_key structure.
Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
The following patch series consolidates the various instances of waitqueue
hashing to use a uniform structure and share the per-zone hashtable among all
waitqueue hashers. This is expected to increase the number of hashtable
buckets available for waiting on bh's and inodes and eliminate statically
allocated kernel data structures for greater node locality and reduced kernel
image size. Some attempt was made to look similar to Oleg Nesterov's
suggested API in order to provide some kind of credit for independent
invention of something very similar (the original versions of these patches
predated my public postings on the subject of filtered waitqueues).
These patches have the further benefit and intention of enabling aio to use
filtered wakeups by standardizing the data structure passed to wake functions
so that embedded waitqueue elements in aio structures may be succesfully
passed to the filtered wakeup wake functions, though this patch series doesn't
implement that particular functionality.
Successfully stress-tested on x86-64, and ia64 in recent prior versions.
This patch:
Move waitqueue -related functions not needing static functions in sched.c
to kernel/wait.c
Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Paulo Marques [Tue, 19 Oct 2004 00:59:03 +0000 (17:59 -0700)]
[PATCH] kallsyms data size reduction / lookup speedup
This patch is an improvement over my first kallsyms speedup patch posted about
2 weeks ago.
It changes scripts/kallsyms as to produce a different format for
kallsyms_names and extra data to speedup lookups. The compression algorithm
is quite simple: it uses all the char codes not actually used in symbols to
build a lookup table that translates these codes into small strings. For
instance, in my test runs the code 0xFE was being translated into "acpi_"
giving a 4 byte save on every translation.
The advantage of this algorithm is that to translate a symbol we only require
information that is stored on that symbol position, and never need to go back
on the compressed stream to get information from other symbols.
To give an idea about the benefits of this algorithm here are some benchmark
results on a P4 2.8GHz with a symbol table with 10000 entries:
kallsyms_lookup average time:
vanilla 1346.0 us
speedup 14.4 us
with this patch 0.5 us
total data produced by scripts/kallsyms:
uncompressed 169 Kb
vanilla 134 Kb
with this patch 91 Kb
(speedup was my latest patch, that only changed the way kallsyms_lookup worked
and not the data format)
I removed a cond_resched() from the proc/kallsyms handling code path, because
using stem compression, if the current position went backwards, the hole
stream would be uncompressed up to the current position. It seemed that by
removing this loop it would be safe to remove the conditional reschedule
altogether.
There is just one catch with this patch: the time it takes to compile the
kernel goes up just a bit (about 0.8s on a P4 2.8GHz with defconfig). If this
delay is not acceptable I can change the compression algorithm so that it can
use the previous table (calculating a new table is what consumes most of the
time, and not doing the actual compression) and check to see if it obtains a
similar compression ratio. If it does, then this is a sign that the symbol
patterns haven't changed that much and this table is still good to use. This
would not only cut the time down to half on any compilation (because of the 2
pass symbol build method), but in frequent cases where a developer is
compiling a single file and linking everything over and over again, the table
optimization process would never run.
I'm CC'ing Brent Casavant on this email, because last june he sent a patch
trying a different approach that used a 32 entry symbol cache, because there
was a problem with the time "top" took to read "proc/<pid>/wchan". I was
hopping he would be willing to test this patch and comment on the results.
Signed-off-by: Paulo Marques <pmarques@grupopie.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
- Key attributes:
- Key type
- Description (by which a key of a particular type can be selected)
- Payload
- UID, GID and permissions mask
- Expiry time
- Keyrings (just a type of key that holds links to other keys)
- User-defined keys
- Key revokation
- Access controls
- Per user key-count and key-memory consumption quota
- Three std keyrings per task: per-thread, per-process, session
- Two std keyrings per user: per-user and default-user-session
- prctl() functions for key and keyring creation and management
- Kernel interfaces for filesystem, blockdev, net stack access
- JIT key creation by usermode helper
David Howells [Tue, 19 Oct 2004 00:58:38 +0000 (17:58 -0700)]
[PATCH] keys: new error codes for Alpha, MIPS, PA-RISC, Sparc & Sparc64
The attached patch adds the new error codes I added for key-related errors to
those archs that don't make use of <asm-generic/errno.h>, including Alpha,
MIPS, PA-RISC, Sparc and Sparc64. This is required to compile with
CONFIG_KEYS on those platforms.
Signed-Off-By: David Howells <dhowells@redhat.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Matthew Dobson [Tue, 19 Oct 2004 00:58:00 +0000 (17:58 -0700)]
[PATCH] Create nodemask_t
The idea behind this patch is to create a nodemask_t as a node analog of
cpumask_t. As NUMA machines become more common, the need for a standard,
cross-platform bitmap of both online & possible nodes becomes more
apparent. We believe we've worked out most of the kinks of the variable
length bitmap types with the recent cpumask_t patches. Nodemasks are also
currently far less widespread than cpumasks. Further, inclusion at this
point in the kernel would mean consistency in node handling between 2.6 and
2.7.
Future goals would be to get rid of the 'numnodes' variable used to count
the number of online nodes, and replace with node_online_map. This would
allow arbitrary node numbering and facilitate node hotplugging.
(Nothing actually uses this yet, but several projects need it, and it does
model a well-defined physical grouping).
Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Peter Osterlund [Tue, 19 Oct 2004 00:57:46 +0000 (17:57 -0700)]
[PATCH] cdrom: buffer sizing fix
The problem is that some drives fail the "GET CONFIGURATION" command when
asked to only return 8 bytes. This happens for example on my drive, which
is identified as:
Peter Osterlund [Tue, 19 Oct 2004 00:57:21 +0000 (17:57 -0700)]
[PATCH] packet-writing: add credits
Nigel pointed out that the earlier patches contained attributions that
are not present in this patch. The 2.4 patch contains:
Nov 5 2001, Aug 8 2002. Modified by Andy Polyakov
<appro@fy.chalmers.se> to support MMC-3 complaint DVD+RW units.
and Nigel changed it to this in his 2.6 patch:
Modified by Nigel Kukard <nkukard@lbsd.net> - support DVD+RW
2.4.x patch by Andy Polyakov <appro@fy.chalmers.se>
The patch I sent you deleted most of the earlier work and moved the
rest to cdrom.c, but the comments were not moved over, since the
earlier authors didn't modify cdrom.c.
Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Ingo Molnar [Mon, 18 Oct 2004 16:12:06 +0000 (09:12 -0700)]
[PATCH] fix & clean up zombie/dead task handling & preemption
This patch fixes all the preempt-after-task->state-is-TASK_DEAD problems we
had. Right now, the moment procfs does a down() that sleeps in
proc_pid_flush() [it could] our TASK_DEAD state is zapped and we might be
back to TASK_RUNNING to and we trigger this assert:
schedule();
BUG();
/* Avoid "noreturn function does return". */
for (;;) ;
I have split out TASK_ZOMBIE and TASK_DEAD into a separate p->exit_state
field, to allow the detaching of exit-signal/parent/wait-handling from
descheduling a dead task. Dead-task freeing is done via PF_DEAD.
Tested the patch on x86 SMP and UP, but all architectures should work
fine.
Ingo Molnar [Mon, 18 Oct 2004 16:11:52 +0000 (09:11 -0700)]
[PATCH] sched: fix SCHED_SMT & numa=fake=2 lockup
This patch fixes an interaction between the numa=fake=<domains> feature,
the domain setup code and cpu_siblings_map[]. The bug leads to a bootup
crash when using numa=fake=2 on a 2-way/4-way SMP+HT box.
When SCHED_SMT is turned on the domains-setup code relies on siblings not
spanning multiple domains (which makes perfect sense). But numa=fake=2
creates an assymetric 1101/0010 splitup between CPUs, which results in two
siblings being on different nodes.
The patch adds a check_siblings_map() function that checks the sibling maps
and fixes them up if they violate this rule. (it also prints a warning in
that case.)
The patch also turns SCHED_DOMAIN_DEBUG back on - had this been enabled
we'd have noticed this bug much earlier.
From: Badari Pulavarty <pbadari@us.ibm.com>
arch/x86_64/mm/numa.c: In function `numa_setup':
arch/x86_64/mm/numa.c:332: error: `numa_fake' undeclared (first use in this function)
arch/x86_64/mm/numa.c:332: error: (Each undeclared identifier is reported only once
arch/x86_64/mm/numa.c:332: error: for each function it appears in.)
Matthew Dobson [Mon, 18 Oct 2004 16:11:27 +0000 (09:11 -0700)]
[PATCH] sched_domains: Make SD_NODE_INIT per-arch #2
Here's yet another version of a patch to implement per-arch SD_*_INITs.
This follows the same basic idea of my last patch, but
1) defines an arch-specific SD_NODE_INIT for the 4 NUMA arches (i386,
x86_64, IA64 & PPC64),
2) defines *default* SD_CPU_INIT & SD_SIBLING_INIT for *all* arches,
with the possibility of them being overridden by simply defining an
arch-specific version in include/asm/topology.h.
The motivation behind the third version of this patch is that Martin feels
that there should be no "default" NUMA initializer because NUMA
characteristics are *very* arch/platform specific, and hence a "default"
NUMA initializer can only lead to confusion. I agree with most of that,
but don't quite see as much harm in having a default as he does.
Nevertheless, to keep him quiet, I've run up this version of the patch.
Martin, please run this through your magic test suite and make sure I
didn't break anything trivial.
Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Peter Williams [Mon, 18 Oct 2004 16:11:14 +0000 (09:11 -0700)]
[PATCH] CPU Scheduler: fix potential error in runqueue nr_uninterruptible count
Problem:
In the function try_to_wake_up(), when the runqueue's nr_uninterruptible
field is decremented it's possible (on SMP systems) that the pointer no
longer points to the runqueue that the task being woken was on when it went
to sleep. This would cause the wrong runqueue's field to be decremented
and the correct one tp remain unchanged.
Fix:
Save a pointer to the old runqueue at the beginning of the function and use
it when decrementing nr_uninterruptible.
Signed-off-by: Peter Williams <pwil3058@bigpond.net.au> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Nick Piggin [Mon, 18 Oct 2004 16:10:50 +0000 (09:10 -0700)]
[PATCH] sched: fixes for ia64 domain setup
Still having some trouble with ia64 domain setup on the Altixes. Jesse
hasn't had much time to look into it, and I'm lacking an Altix, so I'm not
sure if this is right or not...
Anyway, it again does the right thing on the NUMAQ, and fixes some real
bugs, so can you include it please?
* Increase SD_NODES_PER_DOMAIN to 6 from 4 to better match Altix's
topology. A setting of 4 will include this node, the other one
in the brick, and the 2 nodes in the next closest brick, while 6
will catch 2 other bricks. Probably it could be increased even
more.
* Work correctly with sparse and not completely full node maps.
* Nasty typo fixed in find_next_best_node:
- val = node_distance(node, i);
+ val = node_distance(node, n);
* Ensure all nodes are themselves a member of their numa balancing
domain. This is more a precaution against creative implementations
of node_distance.. but it makes the setup easier to verify without
having to look at a table of node_distance's, which is possibly
generated at runtime.
So again, I'm not too sure if this will fix the Altix setup or not. But if
you do a release, it will surely be less broken than it was before.
Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Nick Piggin [Mon, 18 Oct 2004 16:09:48 +0000 (09:09 -0700)]
[PATCH] sched: IA64 add disjoint NUMA domain support
Implement disjoint NUMA domain setup for IA64 architecture. Most of the code
was what was ripped out of kernel/sched.c, which was written by Jesse Barnes
<jbarnes@sgi.com>. I fixed up the tricky NUMA groups initialistion.
Signed-off-by: Nick Piggin <nickpiggin@yahoo.com.au> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Nick Piggin [Mon, 18 Oct 2004 16:09:35 +0000 (09:09 -0700)]
[PATCH] sched: make domain setup overridable
Allow sched domain setup to be overridden by arch code. This functionality
is needed again.
From: Paul Jackson <pj@sgi.com>
Builds of 2.6.9-rc1-mm5 ia64 NUMA configs fail, with many complaints that
SD_NODE_INIT is defined twice, in asm/processor.h and linux/sched.h.
I guess that the preprocessor conditionals were wrong when Nick added the
per-arch override ability again of SD_NODE_INIT were wrong. At least this
change lets me rebuild ia64 again.
Signed-off-by: Nick Piggin <nickpiggin@yahoo.com.au> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Paul Jackson <pj@sgi.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Nick Piggin [Mon, 18 Oct 2004 16:09:10 +0000 (09:09 -0700)]
[PATCH] sched: sched add load balance flag
Introduce SD_LOAD_BALANCE flag for domains where we don't want to do load
balancing (so we don't have to set up meaningless spans and groups). Use this
for the initial dummy domain, and just leave isolated CPUs on the dummy
domain.
Signed-off-by: Nick Piggin <nickpiggin@yahoo.com.au> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Nick Piggin [Mon, 18 Oct 2004 16:08:46 +0000 (09:08 -0700)]
[PATCH] sched: integrate cpu hotplug and sched domains
Register a cpu hotplug notifier which reinitializes the scheduler domains
hierarchy. The notifier temporarily attaches all running cpus to a "dummy"
domain (like we currently do during boot) to avoid balancing. It then calls
arch_init_sched_domains which rebuilds the "real" domains and reattaches the
cpus to them.
Also change __init attributes to __devinit where necessary.
Signed-off-by: Nathan Lynch <nathanl@austin.ibm.com>
Alterations from Nick Piggin:
* Detach all domains in CPU_UP|DOWN_PREPARE notifiers. Reinitialise and
reattach in CPU_ONLINE|DEAD|UP_CANCELED. This ensures the domains as
seen from the scheduler won't become out of synch with the cpu_online_map.
* This allows us to remove runtime cpu_online verifications. Do that.
* Dummy domains are __devinitdata.
* Remove the hackery in arch_init_sched_domains to work around the fact that
the domains used to work with cpu_possible maps, but node_to_cpumask returned
a cpu_online map.
Signed-off-by: Nick Piggin <nickpiggin@yahoo.com.au> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Nick Piggin [Mon, 18 Oct 2004 16:08:34 +0000 (09:08 -0700)]
[PATCH] sched: add CPU_DOWN_PREPARE notifier
Add a CPU_DOWN_PREPARE hotplug CPU notifier. This is needed so we can dettach
all sched-domains before a CPU goes down, thus we can build domains from
online cpumasks, and not have to check for the possibility of a CPU coming up
or going down.
Signed-off-by: Nick Piggin <nickpiggin@yahoo.com.au> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Nick Piggin [Mon, 18 Oct 2004 16:08:22 +0000 (09:08 -0700)]
[PATCH] sched: trivial sched changes
The following patches properly intergrate sched domains and cpu hotplug (using
Nathan's code), by having sched-domains *always* only represent online CPUs,
and having hotplug notifier to keep them up to date.
Then tackle Jesse's domain setup problem: the disjoint top-level domains were
completely broken. The group-list builder thingy simply can't handle distinct
sets of groups containing the same CPUs. The code is ugly and specific enough
that I'm re-introducing the arch overridable domains.
I doubt we'll get a proliferation of implementations, because the current
generic code can do the job for everyone but SGI. I'd rather take a look at
it again down the track if we need to rather than try to shoehorn this into
the generic code.
Nathan and I have tested the hotplug work. He's happy with it.
I've tested the disjoint domain stuff (copied it to i386 for the test), and it
does the right thing on the NUMAQ. I've asked Jesse to test it as well, but
it should be fine - maybe just help me out and run a test compile on ia64 ;)
This really gets sched domains into much better shape. Without further ado,
the patches.
This patch:
Make a definition static and slightly sanitize ifdefs.
Signed-off-by: Nick Piggin <nickpiggin@yahoo.com.au> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
The xtime value may become incorrect when the update_wall_time(ticks)
function is called with "ticks" > 1. In such a case, the xtime variable is
updated multiple times inside the loop but it is normalized only once
outside of the loop.
This bug was reported at:
http://bugme.osdl.org/show_bug.cgi?id=3403
Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Jeff Mahoney [Mon, 18 Oct 2004 16:07:45 +0000 (09:07 -0700)]
[PATCH] ReiserFS: Add I/O error handling to journal operations
This patch allows ReiserFS to handle I/O errors in the journal (or journal
flush) where it would have previously panicked. The new behavior is to
mark the filesystem read-only, disallow new transactions to be started, and
to allow existing transactions to complete (though not to commit). The
resultant filesystem can be safely umounted, and checked via normal
mechanisms. As it is a journaling filesystem, the filesystem itself will
be in a similar state to the power being cut to the machine, once umounted.
Signed-off-by: Jeff Mahoney <jeffm@novell.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>