Hi Linus, this patch makes the pipe code use the slab allocator instead of kmalloc/kfree. The changes are pretty small, so I think it's ok for the stable series. Christoph -- Of course it doesn't work. We've performed a software upgrade. --- linux-2.4.2-pre3/fs/pipe.c Sat Feb 10 20:03:33 2001 +++ linux/fs/pipe.c Sat Feb 10 20:36:57 2001 @@ -21,8 +21,13 @@ * * Reads with count = 0 should always return 0. * -- Julian Bradfield 1999-06-07. + * + * Use slab allocator instead of kmalloc/kfree. + * -- Christoph Hellwig 2001-02-07 */ +static kmem_cache_t * pipe_cachep; + /* Drop the inode semaphore and wait for a pipe event, atomically */ void pipe_wait(struct inode * inode) { @@ -448,7 +453,7 @@ if (!page) return NULL; - inode->i_pipe = kmalloc(sizeof(struct pipe_inode_info), GFP_KERNEL); + inode->i_pipe = kmem_cache_alloc(pipe_cachep, SLAB_KERNEL); if (!inode->i_pipe) goto fail_page; @@ -578,7 +583,7 @@ put_unused_fd(i); close_f12_inode: free_page((unsigned long) PIPE_BASE(*inode)); - kfree(inode->i_pipe); + kmem_cache_free(pipe_cachep, inode->i_pipe); inode->i_pipe = NULL; iput(inode); close_f12: @@ -635,15 +640,28 @@ static int __init init_pipe_fs(void) { - int err = register_filesystem(&pipe_fs_type); - if (!err) { - pipe_mnt = kern_mount(&pipe_fs_type); - err = PTR_ERR(pipe_mnt); - if (IS_ERR(pipe_mnt)) - unregister_filesystem(&pipe_fs_type); - else - err = 0; - } + int err = -ENOMEM; + + pipe_cachep = kmem_cache_create("pipe_cache", + sizeof(struct pipe_inode_info), 0, + SLAB_HWCACHE_ALIGN, NULL, NULL); + if (pipe_cachep == NULL) + goto err_out; + + err = register_filesystem(&pipe_fs_type); + if (err) + goto err_out; + + pipe_mnt = kern_mount(&pipe_fs_type); + + err = PTR_ERR(pipe_mnt); + if (!IS_ERR(pipe_mnt)) + return 0; + + unregister_filesystem(&pipe_fs_type); + +err_out: + kmem_cache_destroy(pipe_cachep); return err; } @@ -651,6 +669,7 @@ { unregister_filesystem(&pipe_fs_type); kern_umount(pipe_mnt); + kmem_cache_destroy(pipe_cachep); } module_init(init_pipe_fs) - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/