summaryrefslogtreecommitdiff
path: root/sys/kern/kern_synch.c
AgeCommit message (Collapse)Author
2004-07-29put the scheduler in its own file. reduces clutter, and logically separatesTed Unangst
"put this process to sleep" and "find a process to run" operations. no functional change. ok art@
2004-07-25move db_show_all_procs to kern_proc.c, proc_printit goes in DDB too.Ted Unangst
shuffle functions around so that scheduler is all together. no real functional changes. ok art@ testing miod@
2004-06-24This moves access to wall and uptime variables in MI code,Thorsten Lockert
encapsulating all such access into wall-defined functions that makes sure locking is done as needed. It also cleans up some uses of wall time vs. uptime some places, but there is sure to be more of these needed as well, particularily in MD code. Also, many current calls to microtime() should probably be changed to getmicrotime(), or to the {,get}microuptime() versions. ok art@ deraadt@ aaron@ matthieu@ beck@ sturm@ millert@ others "Oh, that is not your problem!" from miod@
2004-06-21First step towards more sane time handling in the kernel -- this changesThorsten Lockert
things such that code that only need a second-resolution uptime or wall time, and used to get that from time.tv_secs or mono_time.tv_secs now get this from separate time_t globals time_second and time_uptime. ok art@ niklas@ nordin@
2004-06-20Merge error in smp merge. It's a miracle that people haven't noticed theArtur Grabowski
scheduling errors on non-i386 yet. deraadt@ aaron@ ok
2004-06-13debranch SMP, have funNiklas Hallqvist
2004-06-09Merge in a piece of the SMP branch into HEAD.Artur Grabowski
Introduce the cpu_info structure, p_cpu field in struct proc and global scheduling context and various changed code to deal with this. At the moment no architecture uses this stuff yet, but it will allow us slow and controlled migration to the new APIs. All new code is ifdef:ed out. ok deraadt@ niklas@
2004-01-26having the monotonic thing as DEBUG is not going to get it fixed faster, it ↵Theo de Raadt
is just going to annoy people
2003-12-23enough is enough, driving people insane is not niceTheo de Raadt
2003-12-23print tv_usec fields correctly in reporting conmonotonic timeMichael Shalayeff
2003-12-19Add a check for time not flowing monotonically and just don't changeTodd C. Miller
p->p_rtime in this case instead of zeroing it; based on an idea from nordin@. Also add a printf about microtime() not being monotonic for this case (from miod@) #ifdef DIAGNOSTIC. This version OK otto@
2003-12-15Fix some sign issues that fell out from the change of rlim_t to unsigned.Todd C. Miller
Also add a check for a negative result when subtracting microtime(&now) from runtime and simply treat this as zero. This should *not* happen but due to an apparent bug in microtime on dual clock machines, it does. The microtime bug is currently being examined. Based on a diff from miod@ with help from otto@; ok deraadt@ otto@
2003-12-15workaround a clock tick handling bug that the rlimit code just exposed.Theo de Raadt
2003-06-02Remove the advertising clause in the UCB license which BerkeleyTodd C. Miller
rescinded 22 July 1999. Proofed by myself and Theo.
2003-03-15kill 10 minute non-root suffers stuff. noted that we still have this, byTheo de Raadt
matthieu, who noted it now that X is not running as root. ok nordin
2002-10-15Protect p_priority with splstatclock.Artur Grabowski
2002-07-24fix header printing in show_all_procsMichael Shalayeff
2002-07-03Change all variables definitions (int foo) in sys/sys/*.h to variableMiod Vallat
declarations (extern int foo), and compensate in the appropriate locations.
2002-06-11splassert(IPL_STATCLOCK) mi_switchArtur Grabowski
2002-03-14First round of __P removal in sysTodd C. Miller
2002-03-08semicolon is not always what it seems, replace w/ a \n in asm labelsMichael Shalayeff
2001-11-11Let ltsleep take a const wmesg.Artur Grabowski
2001-11-06Replace inclusion of <vm/foo.h> with the correct <uvm/bar.h> when necessary.Miod Vallat
(Look ma, I might have broken the tree)
2001-09-13Remove a comment that just doesn't make any sense.Artur Grabowski
2001-08-07Change tsleep into ltsleep.Artur Grabowski
ltsleep takes an additional argument - a simplelock and unlocks it when it's safe to do so. tsleep now becomes a wrapper around ltsleep. From NetBSD
2001-06-27remove old vmArtur Grabowski
2001-06-24cold is in systm.h nowMichael Shalayeff
2001-05-26indentation.Artur Grabowski
2001-03-25Reintroduce wakeup callConstantine Sapuntzakis
2001-03-15Print a '*' in front of curproc in ps in ddb.Artur Grabowski
2001-02-27Add wakeup_n and wakeup_one. wakeup_n will wakeup up to n sleeping processesConstantine Sapuntzakis
2001-02-19When doing an assertion for phz, just do it once when we set phz,Artur Grabowski
not once per process.
2000-11-10Change the ktrace interface functions from taking the trace vnode to taking theArtur Grabowski
traced proc. The vnode is in the proc and all functions need the proc.
2000-08-03s/principal/priciple/; from netbsdMichael Shalayeff
2000-07-06Typo in comment and some cleanup of roundrobin.Artur Grabowski
2000-06-27Slight optimization of wakeup.Artur Grabowski
2000-06-05Changes to exit handling.Artur Grabowski
cpu_exit no longer frees the vmspace and u-area. This is now handled by a separate kernel thread "reaper". This is to avoid sleeping locks in the critical path of cpu_exit where we're not allowed to sleep. From NetBSD
2000-04-19Remove the roundrobin_attempts hack and replace it with per-process schedulingArtur Grabowski
flags (much nicer for future smp work). Add two generic functions yield() and preempt(). Use preepmt() in uio when we are told to yield. Based on my idea, code written by Jason Thorpe from NetBSD.
2000-03-23Don't reinitialize the tsleep and ITIMER_REAL timers all the time.Artur Grabowski
The function and the argument never change.
2000-03-23use the new timeout interface for tsleep.Artur Grabowski
2000-03-23Adapt roundrobin and schedcpu to the new timeout API.Artur Grabowski
2000-03-03Keep track of the number of times we trigger a reschedule before theArtur Grabowski
context switch actually happens.
2000-03-03Use the LIST_FIRST macro to get the head of zombproc list.Artur Grabowski
2000-03-03Use LIST_ macros instead of internal field names to walk the allproc list.Artur Grabowski
1999-09-05Use stathz to calculate CPU time when available; fixes CPU calculationThorsten Lockert
problems when stathz runs at different speed than hz/profhz.
1999-08-15Adopt NetBSD fix for scheduler problems (nice was broken). From the NetBSDPaul Janzen
commit messages: Scheduler bug fixes and reorganization * fix the ancient nice(1) bug, where nice +20 processes incorrectly steal 10 - 20% of the CPU, (or even more depending on load average) * provide a new schedclock() mechanism at a new clock at schedhz, so high platform hz values don't cause nice +0 processes to look like they are niced * change the algorithm slightly, and reorganize the code a lot * fix percent-CPU calculation bugs, and eliminate some no-op code === nice bug === Correctly divide the scheduler queues between niced and compute-bound processes. The current nice weight of two (sort of, see `algorithm change' below) neatly divides the USRPRI queues in half; this should have been used to clip p_estcpu, instead of UCHAR_MAX. Besides being the wrong amount, clipping an unsigned char to UCHAR_MAX is a no-op, and it was done after decay_cpu() which can only _reduce_ the value. It has to be kept <= NICE_WEIGHT * PRIO_MAX - PPQ or processes can scheduler-penalize themselves onto the same queue as nice +20 processes. (Or even a higher one.) === New schedclock() mechanism === Some platforms should be cutting down stathz before hitting the scheduler, since the scheduler algorithm only works right in the vicinity of 64 Hz. Rather than prescale hz, then scale back and forth by 4 every time p_estcpu is touched (each occurance an abstraction violation), use p_estcpu without scaling and require schedhz to be generated directly at the right frequency. Use a default stathz (well, actually, profhz) / 4, so nothing changes unless a platform defines schedhz and a new clock. [ To do: Define these for alpha, where hz==1024, and nice was totally broke.] === Algorithm change === The nice value used to be added to the exponentially-decayed scheduler history value p_estcpu, in _addition_ to be incorporated directly (with greater weight) into the priority calculation. At first glance, it appears to be a pointless increase of 1/8 the nice effect (pri = p_estcpu/4 + nice*2), but it's actually at least 3x that because it will ramp up linearly but be decayed only exponentially, thus converging to an additional .75 nice for a loadaverage of one. I killed this: it makes the behavior hard to control, almost impossible to analyze, and the effect (~~nothing at for the first second, then somewhat increased niceness after three seconds or more, depending on load average) pointless. === Other bugs === hz -> profhz in the p_pctcpu = f(p_cpticks) calcuation. Collect scheduler functionality. Try to put each abstraction in just one place.
1999-04-21Improved ps formatting.Alex Feldman
1999-02-26uvm allocation and name changesArtur Grabowski
1998-11-15GC unnecessary declarationArtur Grabowski
1998-02-03bad types; wileyc@sekiya.twics.co.jpTheo de Raadt