diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/exit.c | 9 | ||||
-rw-r--r-- | kernel/fork.c | 65 | ||||
-rw-r--r-- | kernel/ksyms.c | 11 | ||||
-rw-r--r-- | kernel/panic.c | 5 | ||||
-rw-r--r-- | kernel/sched.c | 2 | ||||
-rw-r--r-- | kernel/sys.c | 9 | ||||
-rw-r--r-- | kernel/sysctl.c | 41 |
7 files changed, 115 insertions, 27 deletions
diff --git a/kernel/exit.c b/kernel/exit.c index 88e012ba3..f6e8fb9b1 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -19,6 +19,7 @@ #include <linux/smp.h> #include <linux/smp_lock.h> #include <linux/module.h> +#include <linux/slab.h> #include <asm/system.h> #include <asm/uaccess.h> @@ -367,14 +368,18 @@ static inline void close_files(struct files_struct * files) if (i >= NR_OPEN) break; while (set) { - if (set & 1) + if (set & 1) { close_fp(files->fd[i]); + files->fd[i] = NULL; + } i++; set >>= 1; } } } +extern kmem_cache_t *files_cachep; + static inline void __exit_files(struct task_struct *tsk) { struct files_struct * files = tsk->files; @@ -383,7 +388,7 @@ static inline void __exit_files(struct task_struct *tsk) tsk->files = NULL; if (!--files->count) { close_files(files); - kfree(files); + kmem_cache_free(files_cachep, files); } } } diff --git a/kernel/fork.c b/kernel/fork.c index 804e37bd5..c3bcf7cca 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -11,6 +11,7 @@ * management can be a bitch. See 'mm/mm.c': 'copy_page_tables()' */ +#include <linux/init.h> #include <linux/errno.h> #include <linux/sched.h> #include <linux/kernel.h> @@ -36,6 +37,9 @@ int last_pid=0; /* SLAB cache for mm_struct's. */ kmem_cache_t *mm_cachep; +/* SLAB cache for files structs */ +kmem_cache_t *files_cachep; + struct task_struct *pidhash[PIDHASH_SZ]; spinlock_t pidhash_lock = SPIN_LOCK_UNLOCKED; @@ -52,7 +56,10 @@ static struct uid_taskcount { unsigned short uid; int task_count; } *uidhash[UIDHASH_SZ]; + +#ifdef __SMP__ static spinlock_t uidhash_lock = SPIN_LOCK_UNLOCKED; +#endif kmem_cache_t *uid_cachep; @@ -116,7 +123,7 @@ int charge_uid(struct task_struct *p, int count) return 0; } -void uidcache_init(void) +__initfunc(void uidcache_init(void)) { int i; @@ -148,8 +155,10 @@ static inline int find_empty_process(void) return -EAGAIN; } +#ifdef __SMP__ /* Protects next_safe and last_pid. */ static spinlock_t lastpid_lock = SPIN_LOCK_UNLOCKED; +#endif static int get_pid(unsigned long flags) { @@ -216,7 +225,7 @@ static inline int dup_mmap(struct mm_struct * mm) tmp->vm_next = NULL; inode = tmp->vm_inode; if (inode) { - inode->i_count++; + atomic_inc(&inode->i_count); if (tmp->vm_flags & VM_DENYWRITE) inode->i_writecount--; @@ -294,15 +303,35 @@ static inline int copy_fs(unsigned long clone_flags, struct task_struct * tsk) tsk->fs->count = 1; tsk->fs->umask = current->fs->umask; if ((tsk->fs->root = current->fs->root)) - tsk->fs->root->i_count++; + atomic_inc(&tsk->fs->root->i_count); if ((tsk->fs->pwd = current->fs->pwd)) - tsk->fs->pwd->i_count++; + atomic_inc(&tsk->fs->pwd->i_count); return 0; } +/* return value is only accurate by +-sizeof(long)*8 fds */ +/* XXX make this architecture specific */ +static inline int __copy_fdset(unsigned long *d, unsigned long *src) +{ + int i; + unsigned long *p = src; + unsigned long *max = src; + + for (i = __FDSET_LONGS; i; --i) { + if ((*d++ = *p++) != 0) + max = p; + } + return (max - src)*sizeof(long)*8; +} + +static inline int copy_fdset(fd_set *dst, fd_set *src) +{ + return __copy_fdset(dst->fds_bits, src->fds_bits); +} + static inline int copy_files(unsigned long clone_flags, struct task_struct * tsk) { - int i; + int i; struct files_struct *oldf, *newf; struct file **old_fds, **new_fds; @@ -312,18 +341,18 @@ static inline int copy_files(unsigned long clone_flags, struct task_struct * tsk return 0; } - newf = kmalloc(sizeof(*newf), GFP_KERNEL); + newf = kmem_cache_alloc(files_cachep, SLAB_KERNEL); tsk->files = newf; - if (!newf) + if (!newf) return -1; newf->count = 1; newf->close_on_exec = oldf->close_on_exec; - newf->open_fds = oldf->open_fds; + i = copy_fdset(&newf->open_fds,&oldf->open_fds); old_fds = oldf->fd; new_fds = newf->fd; - for (i = NR_OPEN; i != 0; i--) { + for (; i != 0; i--) { struct file * f = *old_fds; old_fds++; *new_fds = f; @@ -470,3 +499,21 @@ fork_out: unlock_kernel(); return error; } + +static void files_ctor(void *fp, kmem_cache_t *cachep, unsigned long flags) +{ + struct files_struct *f = fp; + + memset(f, 0, sizeof(*f)); +} + +__initfunc(void filescache_init(void)) +{ + files_cachep = kmem_cache_create("files_cache", + sizeof(struct files_struct), + 0, + SLAB_HWCACHE_ALIGN, + files_ctor, NULL); + if (!files_cachep) + panic("Cannot create files cache"); +} diff --git a/kernel/ksyms.c b/kernel/ksyms.c index ec0be876f..8e5607e1e 100644 --- a/kernel/ksyms.c +++ b/kernel/ksyms.c @@ -142,9 +142,8 @@ EXPORT_SYMBOL(getname); EXPORT_SYMBOL(putname); EXPORT_SYMBOL(__fput); EXPORT_SYMBOL(__iget); -EXPORT_SYMBOL(iput); +EXPORT_SYMBOL(_iput); EXPORT_SYMBOL(namei); -EXPORT_SYMBOL(lnamei); EXPORT_SYMBOL(open_namei); EXPORT_SYMBOL(sys_close); EXPORT_SYMBOL(close_fp); @@ -168,8 +167,6 @@ EXPORT_SYMBOL(ll_rw_block); EXPORT_SYMBOL(__wait_on_buffer); EXPORT_SYMBOL(mark_buffer_uptodate); EXPORT_SYMBOL(unlock_buffer); -EXPORT_SYMBOL(dcache_lookup); -EXPORT_SYMBOL(dcache_add); EXPORT_SYMBOL(add_blkdev_randomness); EXPORT_SYMBOL(generic_file_read); EXPORT_SYMBOL(generic_file_write); @@ -245,6 +242,7 @@ EXPORT_SYMBOL(sysctl_string); EXPORT_SYMBOL(sysctl_intvec); EXPORT_SYMBOL(proc_dostring); EXPORT_SYMBOL(proc_dointvec); +EXPORT_SYMBOL(proc_dointvec_jiffies); EXPORT_SYMBOL(proc_dointvec_minmax); /* interrupt handling */ @@ -338,11 +336,12 @@ EXPORT_SYMBOL(read_exec); EXPORT_SYMBOL(si_meminfo); /* Added to make file system as module */ +EXPORT_SYMBOL(get_super); EXPORT_SYMBOL(set_writetime); EXPORT_SYMBOL(sys_tz); EXPORT_SYMBOL(__wait_on_super); EXPORT_SYMBOL(file_fsync); -EXPORT_SYMBOL(clear_inode); +EXPORT_SYMBOL(_clear_inode); EXPORT_SYMBOL(refile_buffer); EXPORT_SYMBOL(nr_async_pages); EXPORT_SYMBOL(___strtok); @@ -353,7 +352,7 @@ EXPORT_SYMBOL(chrdev_inode_operations); EXPORT_SYMBOL(blkdev_inode_operations); EXPORT_SYMBOL(read_ahead); EXPORT_SYMBOL(get_hash_table); -EXPORT_SYMBOL(get_empty_inode); +EXPORT_SYMBOL(_get_empty_inode); EXPORT_SYMBOL(insert_inode_hash); EXPORT_SYMBOL(event); EXPORT_SYMBOL(__down); diff --git a/kernel/panic.c b/kernel/panic.c index c5482bffe..c08b67aab 100644 --- a/kernel/panic.c +++ b/kernel/panic.c @@ -16,6 +16,7 @@ #include <linux/smp.h> #include <linux/reboot.h> #include <linux/init.h> +#include <linux/sysrq.h> #include <asm/sgialib.h> @@ -73,6 +74,8 @@ NORET_TYPE void panic(const char * fmt, ...) printk("Press L1-A to return to the boot prom\n"); #endif sti(); - for(;;); + for(;;) { + CHECK_EMERGENCY_SYNC + } } diff --git a/kernel/sched.c b/kernel/sched.c index 9f32305ee..94662ddb3 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -140,6 +140,7 @@ static inline void move_last_runqueue(struct task_struct * p) prev->next_run = p; } +#ifdef __SMP__ /* * The tasklist_lock protects the linked list of processes. * @@ -154,6 +155,7 @@ static inline void move_last_runqueue(struct task_struct * p) rwlock_t tasklist_lock = RW_LOCK_UNLOCKED; spinlock_t scheduler_lock = SPIN_LOCK_UNLOCKED; static spinlock_t runqueue_lock = SPIN_LOCK_UNLOCKED; +#endif /* * Wake up a process. Put it on the run-queue if it's not diff --git a/kernel/sys.c b/kernel/sys.c index 311527865..ca3d17807 100644 --- a/kernel/sys.c +++ b/kernel/sys.c @@ -4,6 +4,7 @@ * Copyright (C) 1991, 1992 Linus Torvalds */ +#include <linux/config.h> #include <linux/errno.h> #include <linux/sched.h> #include <linux/kernel.h> @@ -20,6 +21,7 @@ #include <linux/fcntl.h> #include <linux/acct.h> #include <linux/tty.h> +#include <linux/nametrans.h> #include <linux/smp.h> #include <linux/smp_lock.h> #include <linux/notifier.h> @@ -397,6 +399,7 @@ int acct_process(long exitcode) acct_file.f_op->write(acct_file.f_inode, &acct_file, (char *)&ac, sizeof(struct acct)); + /* inode->i_status |= ST_MODIFIED is willingly *not* done here */ set_fs(fs); } @@ -940,6 +943,9 @@ asmlinkage int sys_sethostname(char *name, int len) if(copy_from_user(system_utsname.nodename, name, len)) return -EFAULT; system_utsname.nodename[len] = 0; +#ifdef CONFIG_TRANS_NAMES + translations_dirty = 1; +#endif return 0; } @@ -968,6 +974,9 @@ asmlinkage int sys_setdomainname(char *name, int len) if(copy_from_user(system_utsname.domainname, name, len)) return -EFAULT; system_utsname.domainname[len] = 0; +#ifdef CONFIG_TRANS_NAMES + translations_dirty = 1; +#endif return 0; } diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 3f2e86a6b..e4bdcfc1a 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -16,6 +16,7 @@ #include <linux/mm.h> #include <linux/sysctl.h> #include <linux/swapctl.h> +#include <linux/nametrans.h> #include <linux/proc_fs.h> #include <linux/malloc.h> #include <linux/stat.h> @@ -37,9 +38,7 @@ /* External variables not in a header file. */ extern int panic_timeout; -extern int console_loglevel, default_message_loglevel; -extern int minimum_console_loglevel, default_console_loglevel; -extern int C_A_D, swapout_interval; +extern int console_loglevel, C_A_D, swapout_interval; extern int bdf_prm[], bdflush_min[], bdflush_max[]; extern char binfmt_java_interpreter[], binfmt_java_appletviewer[]; extern int sysctl_overcommit_memory; @@ -104,7 +103,6 @@ struct inode_operations proc_sys_inode_operations = NULL, /* mknod */ NULL, /* rename */ NULL, /* readlink */ - NULL, /* follow_link */ NULL, /* readpage */ NULL, /* writepage */ NULL, /* bmap */ @@ -114,6 +112,7 @@ struct inode_operations proc_sys_inode_operations = extern struct proc_dir_entry proc_sys_root; +extern int inodes_stat[]; static void register_proc_table(ctl_table *, struct proc_dir_entry *); static void unregister_proc_table(ctl_table *, struct proc_dir_entry *); #endif @@ -142,7 +141,9 @@ static ctl_table kern_table[] = { 0644, NULL, &proc_dostring, &sysctl_string}, {KERN_DOMAINNAME, "domainname", system_utsname.domainname, 64, 0644, NULL, &proc_dostring, &sysctl_string}, - {KERN_NRINODE, "inode-nr", &nr_inodes, 2*sizeof(int), + {KERN_NRINODE, "inode-nr", &inodes_stat, 2*sizeof(int), + 0444, NULL, &proc_dointvec}, + {KERN_STATINODE, "inode-state", &inodes_stat, 7*sizeof(int), 0444, NULL, &proc_dointvec}, {KERN_MAXINODE, "inode-max", &max_inodes, sizeof(int), 0644, NULL, &proc_dointvec}, @@ -170,6 +171,10 @@ static ctl_table kern_table[] = { {KERN_JAVA_APPLETVIEWER, "java-appletviewer", binfmt_java_appletviewer, 64, 0644, NULL, &proc_dostring, &sysctl_string }, #endif +#ifdef CONFIG_TRANS_NAMES + {KERN_NAMETRANS, "nametrans", nametrans_txt, MAX_DEFAULT_TRANSLEN, + 0644, NULL, &nametrans_dostring, &nametrans_string}, +#endif #ifdef __sparc__ {KERN_SPARC_REBOOT, "reboot-cmd", reboot_command, 256, 0644, NULL, &proc_dostring, &sysctl_string }, @@ -184,6 +189,8 @@ static ctl_table kern_table[] = { static ctl_table vm_table[] = { {VM_SWAPCTL, "swapctl", &swap_control, sizeof(swap_control_t), 0600, NULL, &proc_dointvec}, + {VM_SWAPOUT, "swapout_interval", + &swapout_interval, sizeof(int), 0600, NULL, &proc_dointvec_jiffies}, {VM_FREEPG, "freepages", &min_free_pages, 3*sizeof(int), 0600, NULL, &proc_dointvec}, {VM_BDFLUSH, "bdflush", &bdf_prm, 9*sizeof(int), 0600, NULL, @@ -611,8 +618,8 @@ int proc_dostring(ctl_table *table, int write, struct file *filp, return 0; } -int proc_dointvec(ctl_table *table, int write, struct file *filp, - void *buffer, size_t *lenp) +static int do_proc_dointvec(ctl_table *table, int write, struct file *filp, + void *buffer, size_t *lenp, int conv) { int *i, vleft, first=1, len, left, neg, val; #define TMPBUFLEN 20 @@ -655,7 +662,7 @@ int proc_dointvec(ctl_table *table, int write, struct file *filp, } if (*p < '0' || *p > '9') break; - val = simple_strtoul(p, &p, 0); + val = simple_strtoul(p, &p, 0) * conv; len = p-buf; if ((len < left) && *p && !isspace(*p)) break; @@ -668,7 +675,7 @@ int proc_dointvec(ctl_table *table, int write, struct file *filp, p = buf; if (!first) *p++ = '\t'; - sprintf(p, "%d", *i); + sprintf(p, "%d", (*i) / conv); len = strlen(buf); if (len > left) len = left; @@ -702,6 +709,12 @@ int proc_dointvec(ctl_table *table, int write, struct file *filp, return 0; } +int proc_dointvec(ctl_table *table, int write, struct file *filp, + void *buffer, size_t *lenp) +{ + return do_proc_dointvec(table,write,filp,buffer,lenp,1); +} + int proc_dointvec_minmax(ctl_table *table, int write, struct file *filp, void *buffer, size_t *lenp) { @@ -800,6 +813,13 @@ int proc_dointvec_minmax(ctl_table *table, int write, struct file *filp, return 0; } +/* Like proc_dointvec, but converts seconds to jiffies */ +int proc_dointvec_jiffies(ctl_table *table, int write, struct file *filp, + void *buffer, size_t *lenp) +{ + return do_proc_dointvec(table,write,filp,buffer,lenp,HZ); +} + #else /* CONFIG_PROC_FS */ int proc_dostring(ctl_table *table, int write, struct file *filp, @@ -862,6 +882,9 @@ int sysctl_string(ctl_table *table, int *name, int nlen, if (len == table->maxlen) len--; ((char *) table->data)[len] = 0; +#ifdef CONFIG_TRANS_NAMES + translations_dirty = 1; +#endif } return 0; } |