summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_kse.c
Commit message (Collapse)AuthorAgeFilesLines
* - Borrow the KSE single threading code for exec and exit. We use the checkjeff2003-04-011-3/+7
| | | | | | | | if (p->p_numthreads > 1) and not a flag because action is only necessary if there are other threads. The rest of the system has no need to identify thr threaded processes. - In kern_thread.c use thr_exit1() instead of thread_exit() if P_THREADED is not set.
* - Move p->p_sigmask to td->td_sigmask. Signal masks will be per thread withjeff2003-03-311-4/+11
| | | | | | | a follow on commit to kern_sig.c - signotify() now operates on a thread since unmasked pending signals are stored in the thread. - PS_NEEDSIGCHK moves to TDF_NEEDSIGCHK.
* Check for the PS_NEEDSIGCHK flag in the right flags field.jhb2003-03-281-1/+1
|
* Adjust code for userland preemptive. Userland can set a quantum indavidxu2003-03-191-24/+45
| | | | | | | | | | kse_mailbox to schedule an upcall, this is useful for userland timeout routine, for example pthread_cond_timedwait(). Also extract upcall scheduling code from kse_reassign and create a new function called thread_switchout to include these code. Reviewed by: julain
* Export current time when returning from never blocked syscall.davidxu2003-03-141-1/+8
|
* Lock proc lock before changing p_flag.davidxu2003-03-111-0/+2
|
* Fix signal delivering bug for threaded process.davidxu2003-03-111-6/+4
|
* Fix threaded process job control bug. SMP tested.davidxu2003-03-111-28/+16
| | | | Reviewed by: julian
* Lock sched_lock before modifying td_flags.davidxu2003-03-081-0/+2
|
* Check kse group limit before linking new ksegrp.davidxu2003-02-281-2/+2
|
* Release sched_lock before calling upcall_free.davidxu2003-02-271-1/+1
|
* Change the process flags P_KSES to be P_THREADED.julian2003-02-271-5/+5
| | | | This is just a cosmetic change but I've been meaning to do it for about a year.
* Add a missing '!'.davidxu2003-02-261-2/+2
|
* Add a simple facility to allow round roubin in userland.davidxu2003-02-261-41/+45
| | | | Reviewed by: julain
* Remove a bogus comment.davidxu2003-02-251-6/+0
|
* Remove a XXXKSE. kg_completed now needs proc lock.davidxu2003-02-241-1/+0
|
* Backout last surplus commit. That day just wasn't my day.davidxu2003-02-241-5/+0
|
* If UTS kernel is calling kse_wakeup for itself, do nothing.davidxu2003-02-211-3/+6
|
* Forgot to set KU_DOUPCALL in kse_wakeup.davidxu2003-02-201-0/+1
|
* Add a timeout parameter to kse_release.davidxu2003-02-201-11/+27
|
* Move thread limits testing code up a bit. This let UPCALLING threaddavidxu2003-02-201-26/+27
| | | | takes possible accumulated contexts away.
* Count non-threaded group.davidxu2003-02-191-5/+10
|
* M_WAITOK and remove an useless comment.davidxu2003-02-191-2/+1
|
* Back out M_* changes, per decision of the TRB.imp2003-02-191-3/+3
| | | | Approved by: trb
* Optimize the case when max threads number was hit.davidxu2003-02-191-43/+57
|
* Further fix PS_NEEDSIGCHKdavidxu2003-02-171-0/+2
|
* Move code for detecting PS_NEEDSIGCHK into thread_schedule_upcall,davidxu2003-02-171-0/+2
| | | | I think it is a better place to handle it.
* - Add a new function, thread_signal_add(), that is called from postsig tojeff2003-02-171-28/+34
| | | | | | | | add a signal to a mailbox's pending set. - Add a new function, thread_signal_upcall(), this causes the current thread to upcall so that we can deliver pending signals. Reviewed by: mini
* Move a bunch of flags from the KSE to the thread.julian2003-02-171-4/+1
| | | | | | | | I was in two minds as to where to put them in the first case.. I should have listenned to the other mind. Submitted by: parts by davidxu@ Reviewed by: jeff@ mini@
* - Split the struct kse into struct upcall and struct kse. struct kse willjeff2003-02-171-515/+649
| | | | | | | soon be visible only to schedulers. This greatly simplifies much the KSE code. Submitted by: davidxu
* Reversion of commit by Davidxu plus fixes since applied.julian2003-02-011-648/+515
| | | | | | | | I'm not convinced there is anything major wrong with the patch but them's the rules.. I am using my "David's mentor" hat to revert this as he's offline for a while.
* Only add one tick per tick to the thread stats, instead of some random number.julian2003-01-311-2/+2
|
* Use kg_numupcalls to see if we are closing a thread group,davidxu2003-01-261-2/+2
| | | | not kg_kses which is not changed when a group is still working.
* Move UPCALL related data structure out of kse, introduce a newdavidxu2003-01-261-513/+646
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | data structure called kse_upcall to manage UPCALL. All KSE binding and loaning code are gone. A thread owns an upcall can collect all completed syscall contexts in its ksegrp, turn itself into UPCALL mode, and takes those contexts back to userland. Any thread without upcall structure has to export their contexts and exit at user boundary. Any thread running in user mode owns an upcall structure, when it enters kernel, if the kse mailbox's current thread pointer is not NULL, then when the thread is blocked in kernel, a new UPCALL thread is created and the upcall structure is transfered to the new UPCALL thread. if the kse mailbox's current thread pointer is NULL, then when a thread is blocked in kernel, no UPCALL thread will be created. Each upcall always has an owner thread. Userland can remove an upcall by calling kse_exit, when all upcalls in ksegrp are removed, the group is atomatically shutdown. An upcall owner thread also exits when process is in exiting state. when an owner thread exits, the upcall it owns is also removed. KSE is a pure scheduler entity. it represents a virtual cpu. when a thread is running, it always has a KSE associated with it. scheduler is free to assign a KSE to thread according thread priority, if thread priority is changed, KSE can be moved from one thread to another. When a ksegrp is created, there is always N KSEs created in the group. the N is the number of physical cpu in the current system. This makes it is possible that even an userland UTS is single CPU safe, threads in kernel still can execute on different cpu in parallel. Userland calls kse_create to add more upcall structures into ksegrp to increase concurrent in userland itself, kernel is not restricted by number of upcalls userland provides. The code hasn't been tested under SMP by author due to lack of hardware. Reviewed by: julian
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.alfred2003-01-211-3/+3
| | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
* Remove a KASSERT that can now happen and add a missing setrunnable.julian2003-01-201-0/+2
|
* Check signals for idled threads.davidxu2003-01-071-2/+1
|
* Set kse mailbox pointer to NULL when P_KSES is turned off.davidxu2003-01-041-3/+6
|
* White space fixesjulian2003-01-031-10/+10
|
* Make an explicit flag to indicate that a KSE has a reason to upcall,julian2003-01-031-19/+22
| | | | | | | and use that flag when there is a kse_wakeup() call. It will probably be used with signal delivery as well eventually. Submitted by: davidxu@
* Don't need to set retvals to 0 in the non error case. Theyjulian2003-01-031-9/+0
| | | | | | are set to a good default anyhow. Submitted by: davidxu@
* Adjust code for Julian's last commit. use td_mailbox to detect ifdavidxu2003-01-021-10/+8
| | | | a syscall is from UTS kernel.
* Add code to ddb to allow backtracing an arbitrary thread.julian2002-12-281-241/+273
| | | | | | | | | | | | | | | | | | | | | | | | (show thread {address}) Remove the IDLE kse state and replace it with a change in the way threads sahre KSEs. Every KSE now has a thread, which is considered its "owner" however a KSE may also be lent to other threads in the same group to allow completion of in-kernel work. n this case the owner remains the same and the KSE will revert to the owner when the other work has been completed. All creations of upcalls etc. is now done from kse_reassign() which in turn is called from mi_switch or thread_exit(). This means that special code can be removed from msleep() and cv_wait(). kse_release() does not leave a KSE with no thread any more but converts the existing thread into teh KSE's owner, and sets it up for doing an upcall. It is just inhibitted from being scheduled until there is some reason to do an upcall. Remove all trace of the kse_idle queue since it is no-longer needed. "Idle" KSEs are now on the loanable queue.
* Unbreak the KSE code. Keep track of zobie threads using the Per-CPU storagejulian2002-12-101-123/+72
| | | | | | | | during the context switch. Rearrange thread cleanups to avoid problems with Giant. Clean threads when freed or when recycled. Approved by: re (jhb)
* Under certain circumstances, we were calling kmem_free() frommux2002-11-221-0/+3
| | | | | | | | | | i386 cpu_thread_exit(). This resulted in a panic with WITNESS since we need to hold Giant to call kmem_free(), and we weren't helding it anymore in cpu_thread_exit(). We now do this from a new MD function, cpu_thread_dtor(), called by thread_dtor(). Approved by: re@ Suggested by: jhb
* - Implement a mechanism for allowing schedulers to place scheduler dependantjeff2002-11-211-19/+31
| | | | | | | | | data in the scheduler independant structures (proc, ksegrp, kse, thread). - Implement unused stubs for this mechanism in sched_4bsd. Approved by: re Reviewed by: luigi, trb Tested on: x86, alpha
* Make sure only update wall clock at upcall time, slightly reformatdavidxu2002-11-181-13/+13
| | | | code in kse_relase().
* 1. Support versioning and wall clock in kse mailbox,davidxu2002-11-181-9/+108
| | | | | | | | also add rusage time in thread mailbox. 2. Minor change for thread limit code in thread_user_enter(), fix typo in kse_release() last I committed. Reviewed by: deischen, mini
* include smp.h.julian2002-11-171-0/+1
| | | | | it is required by some code that was commented out until david's last commit.
* 1.Add sysctls to control KSE resource allocation.davidxu2002-11-171-8/+30
| | | | | | | | | | | | | | | | kern.threads.max_threads_per_proc kern.threads.max_groups_per_proc 2.Temporary disable borrower thread stash itself as owner thread's spare thread in thread_exit(). there is a race between owner thread and borrow thread: an owner thread may allocate a spare thread as this: if (td->td_standin == NULL) td->standin = thread_alloc(); but thread_alloc() can block the thread, then a borrower thread would possible stash it self as owner's spare thread in thread_exit(), after owner is resumed, result is a thread leak in kernel, double check in owner can avoid the race, but it may be ugly and not worth to do.
OpenPOWER on IntegriCloud