Andrew Morton [Thu, 4 Jul 2002 15:31:45 +0000 (08:31 -0700)]
[PATCH] ext3 truncate fix
Forward-port of a fix which Stephen has applied to ext3's 2.4 CVS tree.
Fix for a rare problem seen under stress in data=journal mode: if we
have to restart a truncate transaction while traversing the inode's
direct blocks, we need to deal with bh==NULL in ext3_clear_blocks.
Andrew Morton [Thu, 4 Jul 2002 15:31:40 +0000 (08:31 -0700)]
[PATCH] combine generic_writepages() and mpage_writepages()
generic_writepages and mpage_writepages are basically identical,
except one calls ->writepage() and the other calls mpage_writepage().
This duplication is irritating.
The patch folds generic_writepage() into mpage_writepages(). It does
this rather kludgily: if the get_block argument to mpage_writepages()
is NULL then use ->writepage().
Can't think of a better way, really - we could go for a fully-blown
write_actor_t thing, but that would be overly elaborate and would not
allow mpage_writepage() to be inlined inside mpage_writepages(), which
is rather desirable.
Andrew Morton [Thu, 4 Jul 2002 15:31:30 +0000 (08:31 -0700)]
[PATCH] suppress more allocation failure warnings
The `page allocation failure' warning in __alloc_pages() is being a
pain. But I'm persisting with it...
The patch renames PF_RADIX_TREE to PF_NOWARN, and uses it in a few
places where allocations failures are known to happen. These code
paths are well-tested now and suppressing the warning is OK.
Andrew Morton [Thu, 4 Jul 2002 15:31:25 +0000 (08:31 -0700)]
[PATCH] always update page->flags atomically
move_from_swap_cache() and move_to_swap_cache() are playing with
page->flags nonatomically. The page is on the LRU at the time and
another CPU could be altering page->flags concurrently.
The patch converts those functions to use atomic operations.
It also rationalises the number of bits which are cleared. It's not
really clear to me what page flags we really want to set to a known
state in there.
It had no right to go clearing PG_arch_1. I'm now clearing PG_arch_1
inside rmqueue() which is still a bit presumptious.
btw: shmem uses PAGE_CACHE_SIZE and swapper_space uses PAGE_SIZE. I've
been carefully maintaining the distinction, but it looks like shmem
will break if we ever do make these values different.
Also, __add_to_page_cache() was performing a non-atomic RMW against
page->flags, under the assumption that it was a newly allocated page
which no other CPU would look at. Not true - this function is used for
moving anon pages into swapcache. Those anon pages are on the LRU -
other CPUs can be performing operations against page->flags while
__add_to_swap_cache is stomping on them. This had me running around in
circles for two days.
So let's move the initialisation of the page state into rmqueue(),
where the page really is new (could do it in page_cache_alloc,
perhaps).
The SetPageLocked() in __add_to_page_cache() is also rather curious.
Seems OK for both pagecache and swapcache so I covered that with a
comment.
2.4 has the same problem. Basically, add_to_swap_cache() can stomp on
another CPU's manipulation of page->flags. After a quick review of the
code there, it is barely conceivable that a concurrent refill_inactve()
could get its PG_referenced and PG_active bits scribbled on. Rather
unlikely because swap_out() will probably see PageActive() and bale
out.
Also, mark_dirty_kiobuf() could have its PG_dirty bit accidentally
cleared (but try_to_swap_out() sets it again later).
But there may be other code paths. Really, I think this needs fixing
in 2.4 - it's horrid.
Andrew Morton [Thu, 4 Jul 2002 15:31:20 +0000 (08:31 -0700)]
[PATCH] Use __GFP_HIGH in mpage_writepages()
In mpage_writepage(), use __GFP_HIGH when allocating the BIO: writeback
is a memory reclaim function and is entitle to dip into the page
reserves to get its IO underway.
Andrew Morton [Thu, 4 Jul 2002 15:31:15 +0000 (08:31 -0700)]
[PATCH] resurrect __GFP_HIGH
This patch reinstates __GFP_HIGH functionality.
__GFP_HIGH means "able to dip into the emergency pools". However,
somewhere along the line this got broken. __GFP_HIGH ceased to do
anything. Instead, !__GFP_WAIT is used to tell the page allocator to
try harder.
__GFP_HIGH makes sense. The concepts of "unable to sleep" and "should
try harder" are quite separate, and overloading !__GFP_WAIT to mean
"should access emergency pools" seems wrong.
This patch fixes a problem in mempool_alloc(). mempool_alloc() tries
the first allocation with __GFP_WAIT cleared. If that fails, it tries
again with __GFP_WAIT enabled (if the caller can support __GFP_WAIT).
So it is currently performing an atomic allocation first, even though
the caller said that they're prepared to go in and call the page
stealer.
I thought this was a mempool bug, but Ingo said:
> no, it's not GFP_ATOMIC. The important difference is __GFP_HIGH, which
> triggers the intrusive highprio allocation mode. Otherwise gfp_nowait is
> just a nonblocking allocation of the same type as the original gfp_mask.
> ...
> what i've added is a bit more subtle allocation method, with both
> performance and balancing-correctness in mind:
>
> 1. allocate via gfp_mask, but nonblocking
> 2. if failure => try to get from the pool if the pool is 'full enough'.
> 3. if failure => allocate with gfp_mask [which might block]
>
> there is performance data that this method improves bounce-IO performance
> significantly, because even under VM pressure (when gfp_mask would block)
> we can still use up to 50% of the memory pool without blocking (and
> without endangering deadlock-free allocation). Ie. the memory pool is also
> a fast 'frontside cache' of memory elements.
Ingo was assuming that __GFP_HIGH was still functional. It isn't, and the
mempool design wants it.
Andrew Morton [Thu, 4 Jul 2002 15:30:54 +0000 (08:30 -0700)]
[PATCH] set TASK_RUNNING in cond_resched()
do_select() does set_current_state(TASK_INTERRUPTIBLE) then calls
__pollwait() which calls __get_free_page() and the cond_resched() which
I added to the pagecache reclaim code never returns.
The patch makes cond_resched() more useful by setting current->state to
TASK_RUNNING before scheduling.
Andrew Morton [Thu, 4 Jul 2002 15:30:44 +0000 (08:30 -0700)]
[PATCH] shmem fixes
A shmem cleanup/bugfix patch from Hugh Dickins.
- Minor: in try_to_unuse(), only wait on writeout if we actually
started new writeout. Otherwise, there is no need because a
wait_on_page_writeback() has already been executed against this page.
And it's locked, so no new writeback can start.
- Minor: in shmem_unuse_inode(): remove all the
wait_on_page_writeback() logic. We already did that in
try_to_unuse(), adn the page is locked so no new writeback can start.
- Less minor: add a missing a page_cache_release() to
shmem_get_page_locked() in the uncommon case where the page was found
to be under writeout.
Andrew Morton [Thu, 4 Jul 2002 15:30:39 +0000 (08:30 -0700)]
[PATCH] remove swap_get_block()
Patch from Christoph Hellwig removes swap_get_block().
I was sort-of hanging onto this function because it is a standard
get_block function, and maybe perhaps it could be used to make swap use
the regular filesystem I/O functions. We don't want to do that, so
kill it.
Andrew Morton [Thu, 4 Jul 2002 15:30:34 +0000 (08:30 -0700)]
[PATCH] pdflush cleanup
Writeback/pdflush cleanup patch from Steven Augart
* Exposes nr_pdflush_threads as /proc/sys/vm/nr_pdflush_threads, read-only.
(I like this - I expect that management of the pdflush thread pool
will be important for many-spindle machines, and this is a neat way
of getting at the info).
* Adds minimum and maximum checking to the five writable pdflush
and fs-writeback parameters.
* Minor indentation fix in sysctl.c
* mm/pdflush.c now includes linux/writeback.h, which prototypes
pdflush_operation. This is so that the compiler can
automatically check that the prototype matches the definition.
Andrew Morton [Thu, 4 Jul 2002 15:30:20 +0000 (08:30 -0700)]
[PATCH] Remove ext3's buffer_head cache
Removes ext3's open-coded inode and allocation bitmap LRUs.
This patch includes a cleanup to ext3_new_block(). The local variables
`bh', `bh2', `i', `j', `k' and `tmp' have been renamed to something
more palatable.
Andrew Morton [Thu, 4 Jul 2002 15:30:10 +0000 (08:30 -0700)]
[PATCH] per-cpu buffer_head cache
ext2 and ext3 implement a custom LRU cache of buffer_heads - the eight
most-recently-used inode bitmap buffers and the eight MRU block bitmap
buffers.
I don't like them, for a number of reasons:
- The code is duplicated between filesystems
- The functionality is unavailable to other filesystems
- The LRU only applies to bitmap buffers. And not, say, indirects.
- The LRUs are subtly dependent upon lock_super() for protection:
without lock_super protection a bitmap could be evicted and freed
while in use.
And removing this dependence on lock_super() gets us one step on
the way toward getting that semaphore out of the ext2 block allocator -
it causes significant contention under some loads and should be a
spinlock.
- The LRUs pin 64 kbytes per mounted filesystem.
Now, we could just delete those LRUs and rely on the VM to manage the
memory. But that would introduce significant lock contention in
__find_get_block - the blockdev mapping's private_lock and page_lock
are heavily used.
So this patch introduces a transparent per-CPU bh lru which is hidden
inside __find_get_block(), __getblk() and __bread(). It is designed to
shorten code paths and to reduce lock contention. It uses a seven-slot
LRU. It achieves a 99% hit rate in `dbench 64'. It provides benefit
to all filesystems.
The next patches remove the open-coded LRUs from ext2 and ext3.
Taken together, these patches are a code cleanup (300-400 lines gone),
and they reduce lock contention. Anton tested these patches on the
32-way and demonstrated a throughput improvement of up to 15% on
RAM-only dbench runs. See http://samba.org/~anton/linux/2.5.24/dbench/
Most of this benefit is from avoiding find_get_page() on the blockdev
mapping. Because the generic LRU copes with indirect blocks as well as
bitmaps.
Andrew Morton [Thu, 4 Jul 2002 15:30:04 +0000 (08:30 -0700)]
[PATCH] Fix 3c59x driver for some 3c566B's
Fix from Rahul Karnik and Donald Becker - some new 3c566B mini-PCI NICs
refuse to power up the transceiver unless we tickle an undocumented bit
in an undocumented register. They worked this out by before-and-after
diffing of the register contents when it was set up by the Windows
driver.
Jens Axboe [Thu, 20 Jun 2002 07:05:46 +0000 (00:05 -0700)]
[PATCH] uninline elv_next_request()
Uninline elv_next_request() and move it to elevator.c, where it belongs.
Because of CURRENT declaration, this actually saves lots of space. From
Andrew.
Robert Kuebel [Thu, 20 Jun 2002 06:54:52 +0000 (23:54 -0700)]
[PATCH] namespace.c - compiler warning
init_rootfs() (from ramfs) doesn't appear in any header file. I didn't
see any that looked like a good home, so lets put a prototype at the top
of fs/namespace.c. This only use of this function is in namespace.c.
Robert Kuebel [Thu, 20 Jun 2002 06:54:37 +0000 (23:54 -0700)]
[PATCH] 3c509.c - 2_2
This patch makes sure the 3c509 module license is always GPL. Currently
the MODULE_LICENSE() marco is only used when CONFIG_ISAPNP or
CONFIG_ISAPNP_MODULE is defined. I have moved MODULE_LICENSE() to the
#ifdef MODULE section at the bottom of 3c509.c.
[PATCH] remove unnecessary parentheses from expand()
Not sure why I forgot to do this, but here is a small bit of tidying up
of some leftover parentheses from the memlist macro removal. The
parentheses are just noise and should go.
Stephen Rothwell [Thu, 20 Jun 2002 06:53:13 +0000 (23:53 -0700)]
[PATCH] Consolidate sys_pause
14 of our 17 architectures define sys_pause exactly the same
way. The other three don't define it at all. I assume glibc
translates pause() into sigsuspend() or something.
Greg Banks [Thu, 20 Jun 2002 06:51:51 +0000 (23:51 -0700)]
[PATCH] PATCH: kconfig wrong arch symbols
Three arch-determining symbols in drivers/mtd/maps/Config.in are wrong.
They have apparently been generated using the sensible pattern "CONFIG_FOO"
for an architecture "foo"; unfortunately the architectures are not sensible.
CONFIG_SPARC should be CONFIG_SPARC32
CONFIG_I386 should be CONFIG_X86
CONFIG_SH should be CONFIG_SUPERH
The config language is *not* shell. The construct "[ foo ] || [ bar ]"
is legal in shell but not in the config language, where we should use
the equivalent "[ foo -o bar ]"
Three symbols CONFIG_BLK_DEV_ATARAID, CONFIG_BLK_DEV_ATARAID_PDC, and
CONFIG_BLK_DEV_ATARAID_HPT depend on CONFIG_EXPERIMENTAL but do
not say so in their banners.
Four symbols CONFIG_ATM_CLIP, CONFIG_ATM_CLIP_NO_ICMP, CONFIG_ATM_LANE,
and CONFIG_ATM_MPOA depend on CONFIG_EXPERIMENTAL but do not say so
in their banners.
Greg Banks [Thu, 20 Jun 2002 06:42:50 +0000 (23:42 -0700)]
[PATCH] PATCH 2.5: kconfig lowercase EXPERIMENTAL tag
The convention is that symbols that depend on $CONFIG_EXPERIMENTAL are
marked in the banner with the string (EXPERIMENTAL). There are 4 cases
where that string is correctly used but is lowercase instead of uppercase.
Greg Banks [Thu, 20 Jun 2002 06:42:36 +0000 (23:42 -0700)]
[PATCH] PATCH 2.5: kconfig choice default value
The default value specified as the last word of the "choice" statement
should be a unique abbreviation of one of the sub-prompts, not some
random string never seen before.
Rusty Russell [Thu, 20 Jun 2002 06:41:54 +0000 (23:41 -0700)]
[PATCH] Fix SMP compilation with 'multiquad' driver
The 2.4.18pre10 kernel, like many if its predecessors, can't compile
the multiquad driver in an SMP kernel (maybe only as a module; it's
been a long time since I wrote this fix). Here's a patch.
Arnd Bergmann [Thu, 20 Jun 2002 06:41:41 +0000 (23:41 -0700)]
[PATCH] fix lots of warnings about 'struct tty_driver'
When compiling 2.5.20 (and ealier, likely) without procfs, the declaration
for struct tty_driver is missing in proc_fs.h, causing many compiler warnings
that are fixed by this patch.
Andrey Panin [Thu, 20 Jun 2002 06:41:00 +0000 (23:41 -0700)]
[PATCH] add unlikely() into add_timer()
This micropatch adds unlikely() macro into add_timer() bug check code.
Without this path gcc 3.1 makes bad thing reordering printk() into
the middle of function body.
Andreas Dilger [Thu, 20 Jun 2002 06:40:46 +0000 (23:40 -0700)]
[PATCH] TRIVIAL EPERM -> EACCESS
the following micro-patch changes ext[23]_ioctl to return EACCES
(permission denied) instead of EPERM (operation not permitted) if
the caller is not authorized to change the flags on a file.
Andreas Bombe [Thu, 20 Jun 2002 06:40:32 +0000 (23:40 -0700)]
[PATCH] Fix bashisms in scripts_patch-kernel
The following trivial patch makes the patch-kernel script executable by
a bare bone POSIX shell like ash. Either that, or the interpreter line
has to be changed to /bin/bash.
The same patch applies to 2.4 (with some line offset).
Robert Love [Thu, 20 Jun 2002 06:07:45 +0000 (23:07 -0700)]
[PATCH] mark 3 variables as __initdata
The attached patch marks the following variables with __initdata:
arch/i386/kernel/mpparse.c :: static unsigned int num_processors
arch/i386/kernel/smpboot.c :: static int smp_b_stepping
arch/i386/kernel/smpboot.c :: static int max_cpus
The data is static and only used by __init functions so can successfully
be jettisoned after boot. Compiled and booted successfully on an SMP
machine.
I also set max_cpus to NR_CPUS instead of -1. Besides being the
logically correct value and simplifying a loop elsewhere, this change
allows NR_CPUS to be set to various values other than the normal 32
which is growing in utility with the hotplug CPU changes now in
mainline.
Rusty Russell [Thu, 20 Jun 2002 05:42:08 +0000 (22:42 -0700)]
[PATCH] Async Futex
This patch adds a FUTEX_FD call, for opening a file descriptor
attached to a futex, which can be used with poll, select or SIGIO.
Rewritten so that closing fd unpins page, as per Linus's suggestion,
and fixed not to call poll_wait with a spinlock as per Martin Wirth's
sharp eyes.