summaryrefslogtreecommitdiffstats
path: root/sys/kern/sched_ule.c
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2003-04-18 05:24:10 +0000
committerjeff <jeff@FreeBSD.org>2003-04-18 05:24:10 +0000
commit556bb64555ef5aede171c8ea3372a6c814dd324d (patch)
treeecb133d4c62c45e6771dbfb1419dbbb0ba6f6ed3 /sys/kern/sched_ule.c
parentf3007d8862760163521a3a4770ba7fed69e1c2bf (diff)
downloadFreeBSD-src-556bb64555ef5aede171c8ea3372a6c814dd324d.zip
FreeBSD-src-556bb64555ef5aede171c8ea3372a6c814dd324d.tar.gz
- Set the ke_cpu field in sched_add() for interrupt and realtime threads
since they are going on the current cpu and not their previously assigned cpu. - sched_runnable() should only return true in the SMP case if the other processor has more than one thread that is runnable. We can not steal curthread. - Change kseq_print() to accept the cpuid instead of a kseq pointer. This makes use of this function in ddb much easier.
Diffstat (limited to 'sys/kern/sched_ule.c')
-rw-r--r--sys/kern/sched_ule.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c
index d535ad6..433159b 100644
--- a/sys/kern/sched_ule.c
+++ b/sys/kern/sched_ule.c
@@ -236,18 +236,18 @@ static void kseq_add(struct kseq *kseq, struct kse *ke);
static void kseq_rem(struct kseq *kseq, struct kse *ke);
static void kseq_nice_add(struct kseq *kseq, int nice);
static void kseq_nice_rem(struct kseq *kseq, int nice);
-void kseq_print(struct kseq *kseq);
+void kseq_print(int cpu);
#ifdef SMP
struct kseq * kseq_load_highest(void);
#endif
void
-kseq_print(struct kseq *kseq)
+kseq_print(int cpu)
{
+ struct kseq *kseq;
int i;
- if (kseq == NULL)
- kseq = KSEQ_SELF();
+ kseq = KSEQ_CPU(cpu);
printf("kseq:\n");
printf("\tload: %d\n", kseq->ksq_load);
@@ -409,6 +409,7 @@ kseq_setup(struct kseq *kseq)
kseq->ksq_loads[PRI_REALTIME] = 0;
kseq->ksq_loads[PRI_TIMESHARE] = 0;
kseq->ksq_loads[PRI_IDLE] = 0;
+ kseq->ksq_load = 0;
#ifdef SMP
kseq->ksq_rslices = 0;
#endif
@@ -973,7 +974,7 @@ sched_runnable(void)
if (CPU_ABSENT(i))
continue;
kseq = KSEQ_CPU(i);
- if (kseq->ksq_load)
+ if (kseq->ksq_load > 1)
return (1);
}
}
@@ -1071,6 +1072,7 @@ sched_add(struct kse *ke)
kseq = KSEQ_SELF();
ke->ke_runq = kseq->ksq_curr;
ke->ke_slice = SCHED_SLICE_MAX;
+ ke->ke_cpu = PCPU_GET(cpuid);
break;
case PRI_TIMESHARE:
kseq = KSEQ_CPU(ke->ke_cpu);
OpenPOWER on IntegriCloud