diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-07-03 21:46:06 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-07-03 21:46:06 +0000 |
commit | 3e414096429d55fbc8116171bba3487647bbe638 (patch) | |
tree | 2b5fcfd9d16fa3a32c829fc2076f6e3785b43374 /kernel | |
parent | 20b23bfcf36fcb2d16d8b844501072541970637c (diff) |
Merge with Linux 2.4.0-test3-pre2.
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/exec_domain.c | 49 | ||||
-rw-r--r-- | kernel/itimer.c | 1 | ||||
-rw-r--r-- | kernel/ksyms.c | 5 | ||||
-rw-r--r-- | kernel/module.c | 5 | ||||
-rw-r--r-- | kernel/sched.c | 4 | ||||
-rw-r--r-- | kernel/sysctl.c | 4 | ||||
-rw-r--r-- | kernel/timer.c | 50 |
7 files changed, 61 insertions, 57 deletions
diff --git a/kernel/exec_domain.c b/kernel/exec_domain.c index 3f3b5fc16..1daf64cc1 100644 --- a/kernel/exec_domain.c +++ b/kernel/exec_domain.c @@ -104,32 +104,37 @@ int unregister_exec_domain(struct exec_domain *it) void __set_personality(unsigned long personality) { - struct exec_domain *it; + struct exec_domain *it, *prev; it = lookup_exec_domain(personality); - if (it) { - if (atomic_read(¤t->fs->count) != 1) { - struct fs_struct *new = copy_fs_struct(current->fs); - struct fs_struct *old; - if (!new) { - put_exec_domain(it); - return; - } - task_lock(current); - old = current->fs; - current->fs = new; - task_unlock(current); - put_fs_struct(old); - } - /* - * At that point we are guaranteed to be the sole owner of - * current->fs. - */ + if (it == current->exec_domain) { current->personality = personality; - current->exec_domain = it; - set_fs_altroot(); - put_exec_domain(current->exec_domain); + return; + } + if (!it) + return; + if (atomic_read(¤t->fs->count) != 1) { + struct fs_struct *new = copy_fs_struct(current->fs); + struct fs_struct *old; + if (!new) { + put_exec_domain(it); + return; + } + task_lock(current); + old = current->fs; + current->fs = new; + task_unlock(current); + put_fs_struct(old); } + /* + * At that point we are guaranteed to be the sole owner of + * current->fs. + */ + current->personality = personality; + prev = current->exec_domain; + current->exec_domain = it; + set_fs_altroot(); + put_exec_domain(prev); } asmlinkage long sys_personality(unsigned long personality) diff --git a/kernel/itimer.c b/kernel/itimer.c index 6c38477be..79d58220c 100644 --- a/kernel/itimer.c +++ b/kernel/itimer.c @@ -103,7 +103,6 @@ void it_real_fn(unsigned long __data) p->real_timer.expires = jiffies + interval; add_timer(&p->real_timer); } - timer_exit(&p->real_timer); } int do_setitimer(int which, struct itimerval *value, struct itimerval *ovalue) diff --git a/kernel/ksyms.c b/kernel/ksyms.c index f1032de30..2189d87a4 100644 --- a/kernel/ksyms.c +++ b/kernel/ksyms.c @@ -130,6 +130,7 @@ EXPORT_SYMBOL(highmem_start_page); /* filesystem internal functions */ EXPORT_SYMBOL(def_blk_fops); EXPORT_SYMBOL(update_atime); +EXPORT_SYMBOL(get_fs_type); EXPORT_SYMBOL(get_super); EXPORT_SYMBOL(get_empty_super); EXPORT_SYMBOL(getname); @@ -205,7 +206,7 @@ EXPORT_SYMBOL(generic_ro_fops); EXPORT_SYMBOL(generic_buffer_fdatasync); EXPORT_SYMBOL(page_hash_bits); EXPORT_SYMBOL(page_hash_table); -EXPORT_SYMBOL(file_lock_table); +EXPORT_SYMBOL(file_lock_list); EXPORT_SYMBOL(posix_lock_file); EXPORT_SYMBOL(posix_test_lock); EXPORT_SYMBOL(posix_block_lock); @@ -213,7 +214,6 @@ EXPORT_SYMBOL(posix_unblock_lock); EXPORT_SYMBOL(locks_mandatory_area); EXPORT_SYMBOL(dput); EXPORT_SYMBOL(have_submounts); -EXPORT_SYMBOL(d_genocide); EXPORT_SYMBOL(d_find_alias); EXPORT_SYMBOL(d_prune_aliases); EXPORT_SYMBOL(prune_dcache); @@ -502,7 +502,6 @@ EXPORT_SYMBOL(disk_name); /* for md.c */ /* binfmt_aout */ EXPORT_SYMBOL(get_write_access); -EXPORT_SYMBOL(put_write_access); /* dynamic registering of consoles */ EXPORT_SYMBOL(register_console); diff --git a/kernel/module.c b/kernel/module.c index c0c5c9053..5e5fbfe1b 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -326,10 +326,11 @@ sys_init_module(const char *name_user, struct module *mod_user) /* Initialize the module. */ mod->flags |= MOD_INITIALIZING; atomic_set(&mod->uc.usecount,1); - if (mod->init && mod->init() != 0) { + if (mod->init && (error = mod->init()) != 0) { atomic_set(&mod->uc.usecount,0); mod->flags &= ~MOD_INITIALIZING; - error = -EBUSY; + if (error > 0) /* Buggy module */ + error = -EBUSY; goto err0; } atomic_dec(&mod->uc.usecount); diff --git a/kernel/sched.c b/kernel/sched.c index f85cc4213..fa30b0645 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -60,8 +60,8 @@ struct task_struct * init_tasks[NR_CPUS] = {&init_task, }; * The run-queue lock locks the parts that actually access * and change the run-queues, and have to be interrupt-safe. */ -__cacheline_aligned spinlock_t runqueue_lock = SPIN_LOCK_UNLOCKED; /* second */ -__cacheline_aligned rwlock_t tasklist_lock = RW_LOCK_UNLOCKED; /* third */ +spinlock_t runqueue_lock __cacheline_aligned = SPIN_LOCK_UNLOCKED; /* second */ +rwlock_t tasklist_lock __cacheline_aligned = RW_LOCK_UNLOCKED; /* third */ static LIST_HEAD(runqueue_head); diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 5fc0418f9..ab62787d1 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -255,9 +255,9 @@ static ctl_table fs_table[] = { 0444, NULL, &proc_dointvec}, {FS_STATINODE, "inode-state", &inodes_stat, 7*sizeof(int), 0444, NULL, &proc_dointvec}, - {FS_NRFILE, "file-nr", &nr_files, 3*sizeof(int), + {FS_NRFILE, "file-nr", &files_stat, 3*sizeof(int), 0444, NULL, &proc_dointvec}, - {FS_MAXFILE, "file-max", &max_files, sizeof(int), + {FS_MAXFILE, "file-max", &files_stat.max_files, sizeof(int), 0644, NULL, &proc_dointvec}, {FS_NRSUPER, "super-nr", &nr_super_blocks, sizeof(int), 0444, NULL, &proc_dointvec}, diff --git a/kernel/timer.c b/kernel/timer.c index 9fa35a63b..873fef479 100644 --- a/kernel/timer.c +++ b/kernel/timer.c @@ -160,7 +160,9 @@ static inline void internal_add_timer(struct timer_list *timer) list_add(&timer->list, vec->prev); } +/* Initialize both explicitly - let's try to have them in the same cache line */ spinlock_t timerlist_lock = SPIN_LOCK_UNLOCKED; +volatile unsigned long timer_sequence = 0xfee1bad; void add_timer(struct timer_list *timer) { @@ -233,11 +235,12 @@ int del_timer_sync(struct timer_list * timer) spin_lock_irqsave(&timerlist_lock, flags); ret += detach_timer(timer); timer->list.next = timer->list.prev = 0; - running = timer->running; + running = timer_is_running(timer); spin_unlock_irqrestore(&timerlist_lock, flags); if (!running) - return ret; + break; + timer_synchronize(timer); } @@ -295,10 +298,11 @@ repeat: detach_timer(timer); timer->list.next = timer->list.prev = NULL; - timer_set_running(timer); + timer_enter(timer); spin_unlock_irq(&timerlist_lock); fn(data); spin_lock_irq(&timerlist_lock); + timer_exit(); goto repeat; } ++timer_jiffies; @@ -577,27 +581,32 @@ void update_one_process(struct task_struct *p, do_it_prof(p, ticks); } -static void update_process_times(unsigned long ticks, unsigned long system) +/* + * Called from the timer interrupt handler to charge one tick to the current + * process. user_tick is 1 if the tick is user time, 0 for system. + */ +static void update_process_times(int user_tick) { /* * SMP does this on a per-CPU basis elsewhere */ #ifndef CONFIG_SMP - struct task_struct * p = current; - unsigned long user = ticks - system; + struct task_struct *p = current; + int system = !user_tick; + if (p->pid) { - p->counter -= ticks; - if (p->counter <= 0) { + if (--p->counter <= 0) { p->counter = 0; p->need_resched = 1; } if (p->priority < DEF_PRIORITY) - kstat.cpu_nice += user; + kstat.cpu_nice += user_tick; else - kstat.cpu_user += user; + kstat.cpu_user += user_tick; kstat.cpu_system += system; - } - update_one_process(p, ticks, user, system, 0); + } else if (local_bh_count(0) || local_irq_count(0) > 1) + kstat.cpu_system += system; + update_one_process(p, 1, user_tick, system, 0); #endif } @@ -643,7 +652,6 @@ static inline void calc_load(unsigned long ticks) } volatile unsigned long lost_ticks; -static unsigned long lost_ticks_system; /* * This spinlock protect us from races in SMP while playing with xtime. -arca @@ -665,17 +673,10 @@ static inline void update_times(void) lost_ticks = 0; if (ticks) { - unsigned long system; - system = xchg(&lost_ticks_system, 0); - calc_load(ticks); update_wall_time(ticks); - write_unlock_irq(&xtime_lock); - - update_process_times(ticks, system); - - } else - write_unlock_irq(&xtime_lock); + } + write_unlock_irq(&xtime_lock); } void timer_bh(void) @@ -685,13 +686,12 @@ void timer_bh(void) run_timer_list(); } -void do_timer(struct pt_regs * regs) +void do_timer(struct pt_regs *regs) { (*(unsigned long *)&jiffies)++; lost_ticks++; + update_process_times(user_mode(regs)); mark_bh(TIMER_BH); - if (!user_mode(regs)) - lost_ticks_system++; if (tq_timer) mark_bh(TQUEUE_BH); } |