[PATCH] clean module_exit in m68knommu serial drivers
Remove un-used commented module_exit functions from m68knommu
ColdFire and 68328 serial drivers. These drivers currently cannot
be configured as modules, and they have no exit functions.
[PATCH] fix security_initcall in m68knommu linker script
Global SECURITY_INIT macro cannot be used inside .init section
for m68knommu linker script. It is a complete section of its own,
need to just list the components individually.
The intent patches broke behaviour w.r.t. following symlinks when
doing an open() with file creation. The problem occurs in open_namei()
because the LOOKUP_PARENT flag is no longer set when we do the call to
follow_link().
[PATCH] tgkill patch for safe inter-thread signals
This is the updated versions of the patch Ingo sent some time ago to
implement a new tgkill() syscall which specifies the target thread
without any possibility of ambiguity or thread ID wrap races, by passing
in both the thread group _and_ the thread ID as the arguments.
This is really needed since many/most people still run with limited PID
ranges (maybe due to legacy apps breaking) and the PID reuse can cause
problems.
Bruno Ducrot [Mon, 7 Jul 2003 06:04:55 +0000 (23:04 -0700)]
[PATCH] powernow-k7 typo fix
Due to a typo in powernow-k7.c, the value which correspond
to the CPU core multiplicator and the VID value are swapped
when we go down to up in frequency step.
Paul Mackerras [Mon, 7 Jul 2003 06:04:09 +0000 (23:04 -0700)]
[PATCH] Compile fix and cleanup for macserial driver
This adds a declaration that the macserial driver needs in order to
compile correctly, and removes some old SERIAL_DO_RESTART junk which
isn't used (SERIAL_DO_RESTART is never defined in this driver) and which
I think is incorrect anyway, since it looks to me like it would
potentially return an ERESTARTSYS error without a signal pending.
Rusty Russell [Mon, 7 Jul 2003 06:01:50 +0000 (23:01 -0700)]
[PATCH] switch_mm and enter_lazy_tlb: remove cpu arg
switch_mm and enter_lazy_tlb take a CPU arg, which is always
smp_processor_id(). This is misleading, and pointless if they use
per-cpu variables or other optimizations. gcc will eliminate
redundant smp_processor_id() (in inline functions) anyway.
This patch includes the last peices of the flat laoder shared
library support. Define the shared lib limit and implement a
flag for doing kernel level tracing.
Andrew Morton [Sun, 6 Jul 2003 12:41:34 +0000 (05:41 -0700)]
[PATCH] BSD accounting speedup
From: Ingo Molnar <mingo@elte.hu>
Most distributions turn on process accounting - but even the common
'accounting is off' case is horrible SMP-scalability-wise: it accesses a
global spinlock during every sys_exit() call, which bounces like mad on SMP
(and NUMA) systems.
Andrew Morton [Sun, 6 Jul 2003 12:41:12 +0000 (05:41 -0700)]
[PATCH] xattr: fine-grained locking
From: Andreas Gruenbacher <agruen@suse.de>
This patch removes the dependency on i_sem in the getxattr and
listxattr iops of ext2 and ext3. In addition, the global ext[23]_xattr
semaphores go away. Instead of i_sem and the global semaphore, mutual
exclusion is now ensured by per-inode xattr semaphores, and by locking
the buffers before modifying them. The detailed locking strategy is
described in comments in fs/ext[23]/xattr.c.
Due to this change it is no longer necessary to take i_sem in
ext[23]_permission() for retrieving acls, so the
ext[23]_permission_locked() functions go away.
Additionally, the patch fixes a race condition in ext[23]_permission:
Accessing inode->i_acl was protected by the BKL in 2.4; in 2.5 there no
longer is such protection. Instead, inode->i_acl (and inode->i_default_acl)
are now accessed under inode->i_lock. (This could be replaced by RCU in
the future.)
In the ext3 extended attribute code, an new uglines results from locking
at the buffer head level: The buffer lock must be held between testing
if an xattr block can be modified and the actual modification to prevent
races from happening. Before a block can be modified,
ext3_journal_get_write_access() must be called. But this requies an unlocked
buffer, so I call ext3_journal_get_write_access() before locking the
buffer. If it turns out that the buffer cannot be modified,
journal_release_buffer() is called. Calling ext3_journal_get_write_access
after the test but while the buffer is still locked would be much better.
Andrew Morton [Sun, 6 Jul 2003 12:41:05 +0000 (05:41 -0700)]
[PATCH] xattrr: preparation for fine-grained locking
From: Andreas Gruenbacher <agruen@suse.de>
Andrew Morton found that there is lock contention between extended
attribute operations (like reading ACLs, which `ls -l' needs to do)
and other operations on the same files. This is due to the fact that
all extended attribute syscalls take inode->i_sem before calling into
the filesystem code.
To fix this problem, this patch no longer takes inode->i_sem in the
getxattr and listxattr syscalls, and moves the lock taking code into
the file systems. (Another patch improves the locking strategy in
ext2 and ext3.)
Andrew Morton [Sun, 6 Jul 2003 12:40:57 +0000 (05:40 -0700)]
[PATCH] xattr: update-in-place optimisation
From: Andreas Gruenbacher <agruen@suse.de>
It is common to update extended attributes without changing the value's
length. This patch optimizes this case. In addition to that, the current
code tries to recognize early when extended attribute blocks become
empty. This optimization is not of significant value, so this patch
removes it, and moves the empty block test further down.
Andrew Morton [Sun, 6 Jul 2003 12:40:50 +0000 (05:40 -0700)]
[PATCH] xattr: blockdev inode selection fix
From: Andreas Gruenbacher <agruen@suse.de>
The inode->i_bdev field is not the same as inode->i_sb->s_bdev or bh->b_bdev.
We must compare inode->i_sb->s_bdev with bh->b_bdev, or else equal extended
attribute block will not be found.
Andrew Morton [Sun, 6 Jul 2003 12:40:42 +0000 (05:40 -0700)]
[PATCH] xattr: cleanups
From: From: Andreas Gruenbacher <agruen@suse.de>
* Various minor cleanups and simplifications in the extended attributes
and acl code.
* Use a smarter shortcut rule in ext[23]_permission(): If the mask
contains permissions that are not also contained in the group
file mode permission bits, those permissions can never be granted by
an acl. (The previous shortcut rule was more coarse.)
Andrew Morton [Sun, 6 Jul 2003 12:40:14 +0000 (05:40 -0700)]
[PATCH] use task_cpu() not ->thread_info->cpu in sched.c
From: Mikael Pettersson <mikpe@csd.uu.se>
This patch fixes two p->thread_info->cpu occurrences in kernel/sched.c to
use the task_cpu(p) macro instead, which is optimised on UP. Although one
of the occurrences is under #ifdef CONFIG_SMP, it's bad style to use the
raw non-optimisable form in non-arch code.
[PATCH] flat loader v850 specific support abstracted
Architecture specific flat loader code for v850 moved into its
own v850 flat.h header. This patch also adds supporti for a number
of relocation cases that need to be handled at laod time.
Most of this code is originally from Miles Bader <miles@gnu.org>.
[PATCH] shared library support for MMUless binfmt_flat loader
This patch adds shared library support to the MMU application
loader, binfmt_flat. This is not new, it is a forward port from the
same support in 2.4.x kernels with MMUless support, and has been
running for well over a year now. The code support is conditionally
compiled on CONFIG_BINFMT_FLAT_SHARED. This change also abstracts
a bit more architecture dependent code into the separate flat.h
includes.
Basically relocations within an application also carry a tag to
identify what they refer too (this code or which shared library).
This is patched as before at load/run-time with an appropriate
address.
[PATCH] simplify access_ok() for all m68knommu targets
Unify access_ok for all m68knommu targets. All targets use the
common linker script and have common end symbols. So now we can
just use a simple check.
Force PAGE_SIZE for the m68knommu architecture to be an unsigned long.
This makes it consistent with all other architectures and cleans up
a load of compiler warnings.
This improves cold-cache program startup noticeably for me, and
simplifies the read-ahead logic at the same time. The rules for
read-ahead are:
- if the vma is marked random, we just do the regular one-page case.
Obvious.
- if the vma is marked "linear access", we use the regular readahead
code. No change in behaviour there (well, we also only consider it a
_miss_ if it was marked linear access - the "readahead" and
"readaround" things are now totally independent of each other)
- otherwise, we look at how many hits/misses we've had for this
particular file open for mmap, and if we've had noticeably more
misses than hits, we don't bother with read-around.
In particular, this means that the "real" read-ahead logic literally
only needs to worry about finding sequential accesses, and does not
have to worry about the common executable mmap access patthers that
have very different behaviour.
in add_timer_internal() we simply leave the timer pending forever if the
expiry is in more than 0xffffffff jiffies. This means more than 48 days on
eg. ia64 - which is not an unrealistic timeout. IIRC crond is happy to use
extremely large timeouts.
It's better to time out early (if you can call 48 days "early") than to
not time out at all.
This offers a generic do_div64() that actually does the right thing,
unlike some architectures that "optimized" the 64-by-32 divide into
just a 32-bit divide.
Both ppc and sh were already providing an assembly optimized
__div64_32(). I called my function the same, so that their optimized
versions will automatically override mine in lib.a.
I've only tested extensively on m68knommu (uClinux) and made
sure generated code is reasonably short. Should be ok also on
parisc, since it's the same algorithm they were using before.
- add generic C implementations of the do_div() for 32bit and 64bit
archs in asm-generic/div64.h;
- add generic library support function __div64_32() to handle the
full 64/32 case on 32bit archs;
- kill multiple copies of generic do_div() in architecture
specific subdirs. Most copies were either buggy or not doing
what they were supposed to do;
- ensure all surviving instances of do_div() have their parameters
correctly parenthesized to avoid funny side-effects;
Booting kernel 2.5.74 on a PowerMac with CONFIG_BLK_DEV_IDE_PMAC=y
results in an oops during IDE init, and the box then reboots.
The patch below updates drivers/ide/ppc/pmac.c to also set up the
hwif->ide_dma_queued_off and hwif->ide_dma_queued_on function
pointers, which fixes the oops. Tested on my ancient PM4400.
Andrew Morton [Sat, 5 Jul 2003 02:38:20 +0000 (19:38 -0700)]
[PATCH] fix rfcomm oops
From: ilmari@ilmari.org (Dagfinn Ilmari Mannsaker)
It turns out that net/bluetooth/rfcomm/sock.c (and
net/bluetooth/hci_sock.c) had been left out when net_proto_family gained an
owner field, here's a patch that fixes them both.
Andrew Morton [Sat, 5 Jul 2003 02:38:06 +0000 (19:38 -0700)]
[PATCH] fix current->user->__count leak
From: Arvind Kandhare <arvind.kan@wipro.com>
When switch_uid is called, the reference count of the new user is
incremented twice. I think the increment in the switch_uid is done because
of the reparent_to_init() function which does not increase the __count for
root user.
But if switch_uid is called from any other function, the reference count is
already incremented by the caller by calling alloc_uid for the new user.
Hence the count is incremented twice. The user struct will not be deleted
even when there are no processes holding a reference count for it. This
does not cause any problem currently because nothing is dependent on timely
deletion of the user struct.
Andrew Morton [Sat, 5 Jul 2003 02:37:46 +0000 (19:37 -0700)]
[PATCH] after exec_mmap(), exec cannot fail
If de_thread() fails in flush_old_exec() then we try to fail the execve().
That is a bad move, because exec_mmap() has already switched the current
process over to the new mm. The new process is not yet sufficiently set up
to handle the error and the kernel doublefaults and dies. exec_mmap() is the
point of no return.
Change flush_old_exec() to call de_thread() before running exec_mmap() so the
execing program sees the error. I added fault injection to both de_thread()
and exec_mmap() - everything now survives OK.
Andrew Morton [Sat, 5 Jul 2003 02:37:26 +0000 (19:37 -0700)]
[PATCH] block request batching
From: Nick Piggin <piggin@cyberone.com.au>
The following patch gets batching working how it should be.
After a process is woken up, it is allowed to allocate up to 32 requests
for 20ms. It does not stop other processes submitting requests if it isn't
submitting though. This should allow less context switches, and allow
batches of requests from each process to be sent to the io scheduler
instead of 1 request from each process.
tiobench sequential writes are more than tripled, random writes are nearly
doubled over mm1. In earlier tests I generally saw better CPU efficiency
but it doesn't show here. There is still debug to be taken out. Its also
only on UP.
Andrew Morton [Sat, 5 Jul 2003 02:37:12 +0000 (19:37 -0700)]
[PATCH] block batching fairness
From: Nick Piggin <piggin@cyberone.com.au>
This patch fixes the request batching fairness/starvation issue. Its not
clear what is going on with 2.4, but it seems that its a problem around this
area.
Anyway, previously:
* request queue fills up
* process 1 calls get_request, sleeps
* a couple of requests are freed
* process 2 calls get_request, proceeds
* a couple of requests are freed
* process 2 calls get_request...
Now as unlikely as it seems, it could be a problem. Its a fairness problem
that process 2 can skip ahead of process 1 anyway.
With the patch:
* request queue fills up
* any process calling get_request will sleep
* once the queue gets below the batch watermark, processes
start being worken, and may allocate.
This patch includes Chris Mason's fix to only clear queue_full when all tasks
have been woken. Previously I think starvation and unfairness could still
occur.
With this change to the blk-fair-batches patch, Chris is showing some much
improved numbers for 2.4 - 170 ms max wait vs 2700ms without blk-fair-batches
for a dbench 90 run. He didn't indicate how much difference his patch alone
made, but it is an important fix I think.
Andrew Morton [Sat, 5 Jul 2003 02:36:59 +0000 (19:36 -0700)]
[PATCH] allow the IO scheduler to pass an allocation hint to
From: Nick Piggin <piggin@cyberone.com.au>
This patch implements a hint so that AS can tell the request allocator to
allocate a request even if there are none left (the accounting is quite
flexible and easily handles overallocations).
elv_may_queue semantics have changed from "the elevator does _not_ want
another request allocated" to "the elevator _insists_ that another request is
allocated". I couldn't see any harm ;)
Now in practice, AS will only allow _1_ request over the limit, because as
soon as the request is sent to AS, it stops anticipating.
Andrew Morton [Sat, 5 Jul 2003 02:36:51 +0000 (19:36 -0700)]
[PATCH] blk_congestion_wait threshold cleanup
From: Nick Piggin <piggin@cyberone.com.au>
Now that we are counting requests (not requests free), this patch changes
the congested & batch watermarks to be more logical. Also a minor fix to
the sysfs code.
Andrew Morton [Sat, 5 Jul 2003 02:36:37 +0000 (19:36 -0700)]
[PATCH] Use kblockd for running request queues
Using keventd for running request_fns is risky because keventd itself can
block on disk I/O. Use the new kblockd kernel threads for the generic
unplugging.
Andrew Morton [Sat, 5 Jul 2003 02:36:30 +0000 (19:36 -0700)]
[PATCH] anticipatory I/O scheduler
From: Nick Piggin <piggin@cyberone.com.au>
This is the core anticipatory IO scheduler. There are nearly 100 changesets
in this and five months work. I really cannot describe it fully here.
Major points:
- It works by recognising that reads are dependent: we don't know where the
next read will occur, but it's probably close-by the previous one. So once
a read has completed we leave the disk idle, anticipating that a request
for a nearby read will come in.
- There is read batching and write batching logic.
- when we're servicing a batch of writes we will refuse to seek away
for a read for some tens of milliseconds. Then the write stream is
preempted.
- when we're servicing a batch of reads (via anticipation) we'll do
that for some tens of milliseconds, then preempt.
- There are request deadlines, for latency and fairness.
The oldest outstanding request is examined at regular intervals. If
this request is older than a specific deadline, it will be the next
one dispatched. This gives a good fairness heuristic while being simple
because processes tend to have localised IO.
Just about all of the rest of the complexity involves an array of fixups
which prevent most of teh obvious failure modes with anticipation: trying to
not leave the disk head pointlessly idle. Some of these algorithms are:
- Process tracking. If the process whose read we are anticipating submits
a write, abandon anticipation.
- Process exit tracking. If the process whose read we are anticipating
exits, abandon anticipation.
- Process IO history. We accumulate statistical info on the process's
recent IO patterns to aid in making decisions about how long to anticipate
new reads.
Currently thinktime and seek distance are tracked. Thinktime is the
time between when a process's last request has completed and when it
submits another one. Seek distance is simply the number of sectors
between each read request. If either statistic becomes too high, the
it isn't anticipated that the process will submit another read.
The above all means that we need a per-process "io context". This is a fully
refcounted structure. In this patch it is AS-only. later we generalise it a
little so other IO schedulers could use the same framework.
- Requests are grouped as synchronous and asynchronous whereas deadline
scheduler groups requests as reads and writes. This can provide better
sync write performance, and may give better responsiveness with journalling
filesystems (although we haven't done that yet).
We currently detect synchronous writes by nastily setting PF_SYNCWRITE in
current->flags. The plan is to remove this later, and to propagate the
sync hint from writeback_contol.sync_mode into bio->bi_flags thence into
request->flags. Once that is done, direct-io needs to set the BIO sync
hint as well.
- There is also quite a bit of complexity gone into bashing TCQ into
submission. Timing for a read batch is not started until the first read
request actually completes. A read batch also does not start until all
outstanding writes have completed.
AS is the default IO scheduler. deadline may be chosen by booting with
"elevator=deadline".
There are a few reasons for retaining deadline:
- AS is often slower than deadline in random IO loads with large TCQ
windows. The usual real world task here is OLTP database loads.
- deadline is presumably more stable.
- deadline is much simpler.
The tunable per-queue entries under /sys/block/*/iosched/ are all in
milliseconds:
* read_expire
Controls how long until a request becomes "expired".
It also controls the interval between which expired requests are served,
so set to 50, a request might take anywhere < 100ms to be serviced _if_ it
is the next on the expired list.
Obviously it can't make the disk go faster. Result is basically the
timeslice a reader gets in the presence of other IO. 100*((seek time /
read_expire) + 1) is very roughly the % streaming read efficiency your disk
should get in the presence of multiple readers.
* read_batch_expire
Controls how much time a batch of reads is given before pending writes
are served. Higher value is more efficient. Shouldn't really be below
read_expire.
* write_ versions of the above
* antic_expire
Controls the maximum amount of time we can anticipate a good read before
giving up. Many other factors may cause anticipation to be stopped early,
or some processes will not be "anticipated" at all. Should be a bit higher
for big seek time devices though not a linear correspondance - most
processes have only a few ms thinktime.
Andrew Morton [Sat, 5 Jul 2003 02:36:09 +0000 (19:36 -0700)]
[PATCH] Create `kblockd' workqueue
keventd is inappropriate for running block request queues because keventd
itself can get blocked on disk I/O. Via call_usermodehelper()'s vfork and,
presumably, GFP_KERNEL allocations.
So create a new gang of kernel threads whose mandate is for running low-level
disk operations. It must ever block on disk IO, so any memory allocations
should be GFP_NOIO.
We mainly use it for running unplug operations from interrupt context.
Andrew Morton [Sat, 5 Jul 2003 02:36:03 +0000 (19:36 -0700)]
[PATCH] bring back the batch_requests function
From: Nick Piggin <piggin@cyberone.com.au>
The batch_requests function got lost during the merge of the dynamic request
allocation patch.
We need it for the anticipatory scheduler - when the number of threads
exceeds the number of requests, the anticipated-upon task will undesirably
sleep in get_request_wait().
And apparently some block devices which use small requests need it so they
string a decent number together.
This patch proposes a performance fix for the current IPC semaphore
implementation.
There are two shortcoming in the current implementation:
try_atomic_semop() was called two times to wake up a blocked process,
once from the update_queue() (executed from the process that wakes up
the sleeping process) and once in the retry part of the blocked process
(executed from the block process that gets woken up).
A second issue is that when several sleeping processes that are eligible
for wake up, they woke up in daisy chain formation and each one in turn
to wake up next process in line. However, every time when a process
wakes up, it start scans the wait queue from the beginning, not from
where it was last scanned. This causes large number of unnecessary
scanning of the wait queue under a situation of deep wait queue.
Blocked processes come and go, but chances are there are still quite a
few blocked processes sit at the beginning of that queue.
What we are proposing here is to merge the portion of the code in the
bottom part of sys_semtimedop() (code that gets executed when a sleeping
process gets woken up) into update_queue() function. The benefit is two
folds: (1) is to reduce redundant calls to try_atomic_semop() and (2) to
increase efficiency of finding eligible processes to wake up and higher
concurrency for multiple wake-ups.
We have measured that this patch improves throughput for a large
application significantly on a industry standard benchmark.
This patch is relative to 2.5.72. Any feedback is very much
appreciated.
Both number of function calls to try_atomic_semop() and update_queue()
are reduced by 50% as a result of the merge. Execution time of
sys_semtimedop is reduced because of the reduction in the low level
functions.
Andrew Morton [Sat, 5 Jul 2003 02:35:49 +0000 (19:35 -0700)]
[PATCH] PCI domain scanning fix
From: Matthew Wilcox <willy@debian.org>
ppc64 oopses on boot because pci_scan_bus_parented() is unexpectedly
returning NULL. Change pci_scan_bus_parented() to correctly handle
overlapping PCI bus numbers on different domains.
If a signal is sent via kill() or tkill() the kernel fills in the wrong
PID value in the siginfo_t structure (obviously only if the handler has
SA_SIGINFO set).
POSIX specifies the the si_pid field is filled with the process ID, and
in Linux parlance that's the "thread group" ID, not the thread ID.
When forcing through a signal for some thread-synchronous
event (ie SIGSEGV, SIGFPE etc that happens as a result of a
trap as opposed to an external event), if the signal is
blocked we will not invoce a signal handler, we will just
kill the thread with the signal.
This is equivalent to what we do in the SIG_IGN case: you
cannot ignore or block synchronous signals, and if you try,
we'll just have to kill you.
We don't want to handle endless recursive faults, which the
old behaviour easily led to if the stack was bad, for example.
Marc Zyngier [Fri, 4 Jul 2003 10:00:47 +0000 (03:00 -0700)]
[PATCH] EISA: avoid unnecessary probing
- By default, do not try to probe the bus if the mainboard does not
seems to support EISA (allow this behaviour to be changed through a
command-line option).