diff options
| author | Vojtech Pavlik <vojtech@suse.cz> | 2002-11-11 11:29:50 +0100 |
|---|---|---|
| committer | Vojtech Pavlik <vojtech@suse.cz> | 2002-11-11 11:29:50 +0100 |
| commit | cdd78a965de150f55dc6bc2836995e5f8bc991a9 (patch) | |
| tree | 9bb3263b0110d8606c393810bf52e7911e59d3df /kernel | |
| parent | 20889760dda09fd104cfe859b03b3f63300faa83 (diff) | |
| parent | 5be2bc3c89f6813ab0ab21cdd27d6d0f2ee94d91 (diff) | |
Merge suse.cz:/home/vojtech/bk/linus into suse.cz:/home/vojtech/bk/input
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/sched.c | 51 | ||||
| -rw-r--r-- | kernel/sysctl.c | 14 |
2 files changed, 49 insertions, 16 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 6821d73ff10b..35373ad017f5 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -157,6 +157,7 @@ struct runqueue { task_t *migration_thread; struct list_head migration_queue; + atomic_t nr_iowait; } ____cacheline_aligned; static struct runqueue runqueues[NR_CPUS] __cacheline_aligned; @@ -557,9 +558,11 @@ unsigned long nr_uninterruptible(void) { unsigned long i, sum = 0; - for (i = 0; i < NR_CPUS; i++) + for (i = 0; i < NR_CPUS; i++) { + if (!cpu_online(i)) + continue; sum += cpu_rq(i)->nr_uninterruptible; - + } return sum; } @@ -567,9 +570,23 @@ unsigned long nr_context_switches(void) { unsigned long i, sum = 0; - for (i = 0; i < NR_CPUS; i++) + for (i = 0; i < NR_CPUS; i++) { + if (!cpu_online(i)) + continue; sum += cpu_rq(i)->nr_switches; + } + return sum; +} + +unsigned long nr_iowait(void) +{ + unsigned long i, sum = 0; + for (i = 0; i < NR_CPUS; ++i) { + if (!cpu_online(i)) + continue; + sum += atomic_read(&cpu_rq(i)->nr_iowait); + } return sum; } @@ -875,7 +892,7 @@ void scheduler_tick(int user_ticks, int sys_ticks) /* note: this timer irq context must be accounted for as well */ if (irq_count() - HARDIRQ_OFFSET >= SOFTIRQ_OFFSET) kstat_cpu(cpu).cpustat.system += sys_ticks; - else if (atomic_read(&nr_iowait_tasks) > 0) + else if (atomic_read(&rq->nr_iowait) > 0) kstat_cpu(cpu).cpustat.iowait += sys_ticks; else kstat_cpu(cpu).cpustat.idle += sys_ticks; @@ -1712,6 +1729,31 @@ void yield(void) sys_sched_yield(); } +/* + * This task is about to go to sleep on IO. Increment rq->nr_iowait so + * that process accounting knows that this is a task in IO wait state. + * + * But don't do that if it is a deliberate, throttling IO wait (this task + * has set its backing_dev_info: the queue against which it should throttle) + */ +void io_schedule(void) +{ + struct runqueue *rq = this_rq(); + + atomic_inc(&rq->nr_iowait); + schedule(); + atomic_dec(&rq->nr_iowait); +} + +void io_schedule_timeout(long timeout) +{ + struct runqueue *rq = this_rq(); + + atomic_inc(&rq->nr_iowait); + schedule_timeout(timeout); + atomic_dec(&rq->nr_iowait); +} + /** * sys_sched_get_priority_max - return maximum RT priority. * @policy: scheduling class. @@ -2160,6 +2202,7 @@ void __init sched_init(void) rq->expired = rq->arrays + 1; spin_lock_init(&rq->lock); INIT_LIST_HEAD(&rq->migration_queue); + atomic_set(&rq->nr_iowait, 0); for (j = 0; j < 2; j++) { array = rq->arrays + j; diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 0317dd749b2b..c6eeba758371 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -31,7 +31,7 @@ #include <linux/sysrq.h> #include <linux/highuid.h> #include <linux/writeback.h> - +#include <linux/hugetlb.h> #include <asm/uaccess.h> #ifdef CONFIG_ROOT_NFS @@ -99,11 +99,6 @@ int proc_dol2crvec(ctl_table *table, int write, struct file *filp, extern int acct_parm[]; #endif -#ifdef CONFIG_HUGETLB_PAGE -extern int htlbpage_max; -extern int set_hugetlb_mem_size(int); -#endif - static int parse_table(int *, int, void *, size_t *, void *, size_t, ctl_table *, void **); static int proc_doutsstring(ctl_table *table, int write, struct file *filp, @@ -315,8 +310,7 @@ static ctl_table vm_table[] = { 0644, NULL, &proc_dointvec_minmax, &sysctl_intvec, NULL, &zero, &one_hundred }, #ifdef CONFIG_HUGETLB_PAGE - {VM_HUGETLB_PAGES, "nr_hugepages", &htlbpage_max, sizeof(int), 0644, NULL, - &proc_dointvec}, + {VM_HUGETLB_PAGES, "nr_hugepages", &htlbpage_max, sizeof(int), 0644, NULL, &hugetlb_sysctl_handler}, #endif {0} }; @@ -907,10 +901,6 @@ static int do_proc_dointvec(ctl_table *table, int write, struct file *filp, val = -val; buffer += len; left -= len; -#ifdef CONFIG_HUGETLB_PAGE - if (i == &htlbpage_max) - val = set_hugetlb_mem_size(val); -#endif switch(op) { case OP_SET: *i = val; break; case OP_AND: *i &= val; break; |
