diff options
author | julian <julian@FreeBSD.org> | 2004-09-05 02:09:54 +0000 |
---|---|---|
committer | julian <julian@FreeBSD.org> | 2004-09-05 02:09:54 +0000 |
commit | 5813d2702971c0732a69541a73be8c44114dd183 (patch) | |
tree | 18da20638d66699090b682ef6c65384dc44ef3e3 /sys/sys/sched.h | |
parent | 6f864d0a973a7f3987d73132be311b7cfbd1ccfc (diff) | |
download | FreeBSD-src-5813d2702971c0732a69541a73be8c44114dd183.zip FreeBSD-src-5813d2702971c0732a69541a73be8c44114dd183.tar.gz |
Refactor a bunch of scheduler code to give basically the same behaviour
but with slightly cleaned up interfaces.
The KSE structure has become the same as the "per thread scheduler
private data" structure. In order to not make the diffs too great
one is #defined as the other at this time.
The KSE (or td_sched) structure is now allocated per thread and has no
allocation code of its own.
Concurrency for a KSEGRP is now kept track of via a simple pair of counters
rather than using KSE structures as tokens.
Since the KSE structure is different in each scheduler, kern_switch.c
is now included at the end of each scheduler. Nothing outside the
scheduler knows the contents of the KSE (aka td_sched) structure.
The fields in the ksegrp structure that are to do with the scheduler's
queueing mechanisms are now moved to the kg_sched structure.
(per ksegrp scheduler private data structure). In other words how the
scheduler queues and keeps track of threads is no-one's business except
the scheduler's. This should allow people to write experimental
schedulers with completely different internal structuring.
A scheduler call sched_set_concurrency(kg, N) has been added that
notifies teh scheduler that no more than N threads from that ksegrp
should be allowed to be on concurrently scheduled. This is also
used to enforce 'fainess' at this time so that a ksegrp with
10000 threads can not swamp a the run queue and force out a process
with 1 thread, since the current code will not set the concurrency above
NCPU, and both schedulers will not allow more than that many
onto the system run queue at a time. Each scheduler should eventualy develop
their own methods to do this now that they are effectively separated.
Rejig libthr's kernel interface to follow the same code paths as
linkse for scope system threads. This has slightly hurt libthr's performance
but I will work to recover as much of it as I can.
Thread exit code has been cleaned up greatly.
exit and exec code now transitions a process back to
'standard non-threaded mode' before taking the next step.
Reviewed by: scottl, peter
MFC after: 1 week
Diffstat (limited to 'sys/sys/sched.h')
-rw-r--r-- | sys/sys/sched.h | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/sys/sys/sched.h b/sys/sys/sched.h index ae453c7..472af52 100644 --- a/sys/sys/sched.h +++ b/sys/sys/sched.h @@ -46,7 +46,7 @@ int sched_runnable(void); * Proc related scheduling hooks. */ void sched_exit(struct proc *p, struct thread *childtd); -void sched_fork(struct thread *td, struct proc *child); +void sched_fork(struct thread *td, struct thread *childtd); /* * KSE Groups contain scheduling priority information. They record the @@ -74,7 +74,6 @@ void sched_wakeup(struct thread *td); * Threads are moved on and off of run queues */ void sched_add(struct thread *td, int flags); -struct kse *sched_choose(void); /* XXX Should be thread * */ void sched_clock(struct thread *td); void sched_rem(struct thread *td); @@ -87,26 +86,15 @@ static __inline void sched_pin(void); void sched_unbind(struct thread *td); static __inline void sched_unpin(void); -/* - * These interfaces will eventually be removed. - */ -void sched_exit_kse(struct kse *ke, struct thread *childtd); -void sched_fork_kse(struct thread *td, struct kse *child); /* * These procedures tell the process data structure allocation code how * many bytes to actually allocate. */ -int sched_sizeof_kse(void); int sched_sizeof_ksegrp(void); int sched_sizeof_proc(void); int sched_sizeof_thread(void); -extern struct ke_sched *kse0_sched; -extern struct kg_sched *ksegrp0_sched; -extern struct p_sched *proc0_sched; -extern struct td_sched *thread0_sched; - static __inline void sched_pin(void) { @@ -119,4 +107,13 @@ sched_unpin(void) curthread->td_pinned--; } +/* temporarily here */ +void schedinit(void); +void sched_destroyproc(struct proc *p); +void sched_init_concurrency(struct ksegrp *kg); +void sched_set_concurrency(struct ksegrp *kg, int cuncurrency); +void sched_schedinit(void); +void sched_newproc(struct proc *p, struct ksegrp *kg, struct thread *td); +void sched_thread_exit(struct thread *td); +void sched_newthread(struct thread *td); #endif /* !_SYS_SCHED_H_ */ |