History log of /freebsd/sys/kern/sched_4bsd.c (Results 226 – 250 of 447)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# b41f1452 13-Jun-2006 David Xu <davidxu@FreeBSD.org>

Add scheduler CORE, the work I have done half a year ago, recent,
I picked it up again. The scheduler is forked from ULE, but the
algorithm to detect an interactive process is almost completely
diffe

Add scheduler CORE, the work I have done half a year ago, recent,
I picked it up again. The scheduler is forked from ULE, but the
algorithm to detect an interactive process is almost completely
different with ULE, it comes from Linux paper "Understanding the
Linux 2.6.8.1 CPU Scheduler", although I still use same word
"score" as a priority boost in ULE scheduler.

Briefly, the scheduler has following characteristic:
1. Timesharing process's nice value is seriously respected,
timeslice and interaction detecting algorithm are based
on nice value.
2. per-cpu scheduling queue and load balancing.
3. O(1) scheduling.
4. Some cpu affinity code in wakeup path.
5. Support POSIX SCHED_FIFO and SCHED_RR.
Unlike scheduler 4BSD and ULE which using fuzzy RQ_PPQ, the scheduler
uses 256 priority queues. Unlike ULE which using pull and push, the
scheduelr uses pull method, the main reason is to let relative idle
cpu do the work, but current the whole scheduler is protected by the
big sched_lock, so the benefit is not visible, it really can be worse
than nothing because all other cpu are locked out when we are doing
balancing work, which the 4BSD scheduelr does not have this problem.
The scheduler does not support hyperthreading very well, in fact,
the scheduler does not make the difference between physical CPU and
logical CPU, this should be improved in feature. The scheduler has
priority inversion problem on MP machine, it is not good for
realtime scheduling, it can cause realtime process starving.
As a result, it seems the MySQL super-smack runs better on my
Pentium-D machine when using libthr, despite on UP or SMP kernel.

show more ...


# 0ae716e5 06-Jun-2006 David Xu <davidxu@FreeBSD.org>

Make ke_rqindex unsigned.


Revision tags: release/5.5.0_cvs, release/5.5.0, release/6.1.0_cvs, release/6.1.0
# 5c06d111 27-Apr-2006 John-Mark Gurney <jmg@FreeBSD.org>

back out for now... revert ccpu to being kern.ccpu...


# c71ce6a4 26-Apr-2006 John-Mark Gurney <jmg@FreeBSD.org>

move remaining sysctl into the kern.sched tree...


# 0f180a7c 17-Apr-2006 John Baldwin <jhb@FreeBSD.org>

Change msleep() and tsleep() to not alter the calling thread's priority
if the specified priority is zero. This avoids a race where the calling
thread could read a snapshot of it's current priority,

Change msleep() and tsleep() to not alter the calling thread's priority
if the specified priority is zero. This avoids a race where the calling
thread could read a snapshot of it's current priority, then a different
thread could change the first thread's priority, then the original thread
would call sched_prio() inside msleep() undoing the change made by the
second thread. I used a priority of zero as no thread that calls msleep()
or tsleep() should be specifying a priority of zero anyway.

The various places that passed 'curthread->td_priority' or some variant
as the priority now pass 0.

show more ...


Revision tags: release/6.0.0_cvs, release/6.0.0
# 4da0d332 24-Jun-2005 Peter Wemm <peter@FreeBSD.org>

Move HWPMC_HOOKS into its own opt_hwpmc_hooks.h file. It doesn't merit
being in opt_global.h and forcing a global recompile when only a few files
reference it.

Approved by: re


# a3f2d842 09-Jun-2005 Stephan Uphoff <ups@FreeBSD.org>

Lots of whitespace cleanup.
Fix for broken if condition.

Submitted by: nate@


# f3a0f873 09-Jun-2005 Stephan Uphoff <ups@FreeBSD.org>

Fix some race conditions for pinned threads that may cause them to run
on the wrong CPU.

Add IPI support for preempting a thread on another CPU.

MFC after:3 weeks


Revision tags: release/5.4.0_cvs, release/5.4.0
# ebccf1e3 19-Apr-2005 Joseph Koshy <jkoshy@FreeBSD.org>

Bring a working snapshot of hwpmc(4), its associated libraries, userland utilities
and documentation into -CURRENT.

Bump FreeBSD_version.

Reviewed by: alc, jhb (kernel changes)


# f3050486 15-Apr-2005 Maxim Konovalov <maxim@FreeBSD.org>

Fix a typo in the comment.

Noticed by: Samy Al Bahra


# 77918643 08-Apr-2005 Stephan Uphoff <ups@FreeBSD.org>

Sprinkle some volatile magic and rearrange things a bit to avoid race
conditions in critical_exit now that it no longer blocks interrupts.

Reviewed by: jhb


Revision tags: release/4.11.0_cvs, release/4.11.0
# f5c157d9 30-Dec-2004 John Baldwin <jhb@FreeBSD.org>

Rework the interface between priority propagation (lending) and the
schedulers a bit to ensure more correct handling of priorities and fewer
priority inversions:
- Add two functions to the sched(9) A

Rework the interface between priority propagation (lending) and the
schedulers a bit to ensure more correct handling of priorities and fewer
priority inversions:
- Add two functions to the sched(9) API to handle priority lending:
sched_lend_prio() and sched_unlend_prio(). The turnstile code uses these
functions to ask the scheduler to lend a thread a set priority and to
tell the scheduler when it thinks it is ok for a thread to stop borrowing
priority. The unlend case is slightly complex in that the turnstile code
tells the scheduler what the minimum priority of the thread needs to be
to satisfy the requirements of any other threads blocked on locks owned
by the thread in question. The scheduler then decides where the thread
can go back to normal mode (if it's normal priority is high enough to
satisfy the pending lock requests) or it it should continue to use the
priority specified to the sched_unlend_prio() call. This involves adding
a new per-thread flag TDF_BORROWING that replaces the ULE-only kse flag
for priority elevation.
- Schedulers now refuse to lower the priority of a thread that is currently
borrowing another therad's priority.
- If a scheduler changes the priority of a thread that is currently sitting
on a turnstile, it will call a new function turnstile_adjust() to inform
the turnstile code of the change. This function resorts the thread on
the priority list of the turnstile if needed, and if the thread ends up
at the head of the list (due to having the highest priority) and its
priority was raised, then it will propagate that new priority to the
owner of the lock it is blocked on.

Some additional fixes specific to the 4BSD scheduler include:
- Common code for updating the priority of a thread when the user priority
of its associated kse group has been consolidated in a new static
function resetpriority_thread(). One change to this function is that
it will now only adjust the priority of a thread if it already has a
time sharing priority, thus preserving any boosts from a tsleep() until
the thread returns to userland. Also, resetpriority() no longer calls
maybe_resched() on each thread in the group. Instead, the code calling
resetpriority() is responsible for calling resetpriority_thread() on
any threads that need to be updated.
- schedcpu() now uses resetpriority_thread() instead of just calling
sched_prio() directly after it updates a kse group's user priority.
- sched_clock() now uses resetpriority_thread() rather than writing
directly to td_priority.
- sched_nice() now updates all the priorities of the threads after the
group priority has been adjusted.

Discussed with: bde
Reviewed by: ups, jeffr
Tested on: 4bsd, ule
Tested on: i386, alpha, sparc64

show more ...


# 907bdbc2 26-Dec-2004 Jeff Roberson <jeff@FreeBSD.org>

- Wrap the thread count adjustment in sched_load_add() and sched_load_rem()
so that we may place some ktr entries nearby.
- Define other KTR_SCHED tracepoints so that we may graph the operation

- Wrap the thread count adjustment in sched_load_add() and sched_load_rem()
so that we may place some ktr entries nearby.
- Define other KTR_SCHED tracepoints so that we may graph the operation
of the scheduler.

show more ...


# 7842f65e 14-Dec-2004 Jeff Roberson <jeff@FreeBSD.org>

- Garbage collect several unused members of struct kse and struce ksegrp.
As best as I can tell, some of these were never used.


# 56564741 07-Dec-2004 Stephan Uphoff <ups@FreeBSD.org>

Propagate TDF_NEEDRESCHED to replacement thread in sched_switch().

Reviewed by: julian, jhb (in October)
Approved by: sam (mentor)
MFC after: 4 weeks


Revision tags: release/5.3.0_cvs, release/5.3.0
# c20c691b 06-Oct-2004 Julian Elischer <julian@FreeBSD.org>

When preempting a thread, put it back on the HEAD of its run queue.
(Only really implemented in 4bsd)

MFC after: 4 days


# d39063f2 05-Oct-2004 Julian Elischer <julian@FreeBSD.org>

Use some macros to trach available scheduler slots to allow
easier debugging.

MFC after: 4 days


# 14f0e2e9 16-Sep-2004 Julian Elischer <julian@FreeBSD.org>

clean up thread runq accounting a bit.

MFC after: 3 days


# b2578c6c 14-Sep-2004 Julian Elischer <julian@FreeBSD.org>

Add some kasserts


# 1e7fad6b 11-Sep-2004 Scott Long <scottl@FreeBSD.org>

Revert the previous round of changes to td_pinned. The scheduler isn't
fully initialed when the pmap layer tries to call sched_pini() early in the
boot and results in an quick panic. Use ke_pinned

Revert the previous round of changes to td_pinned. The scheduler isn't
fully initialed when the pmap layer tries to call sched_pini() early in the
boot and results in an quick panic. Use ke_pinned instead as was originally
done with Tor's patch.

Approved by: julian

show more ...


# 5c854acc 11-Sep-2004 Julian Elischer <julian@FreeBSD.org>

Make up my mind if cpu pinning is stored in the thread structure or the
scheduler specific extension to it. Put it in the extension as
the implimentation details of how the pinning is done needn't be

Make up my mind if cpu pinning is stored in the thread structure or the
scheduler specific extension to it. Put it in the extension as
the implimentation details of how the pinning is done needn't be visible
outside the scheduler.

Submitted by: tegge (of course!) (with changes)
MFC after: 3 days

show more ...


# 3389af30 10-Sep-2004 Julian Elischer <julian@FreeBSD.org>

Add some code to allow threads to nominat a sibling to run if theyu are going to sleep.

MFC after: 1 week


# 6a574b2a 06-Sep-2004 Julian Elischer <julian@FreeBSD.org>

Don't do IPIs on behalf of interrupt threads.
just punt straight on through to teh preemption code.

Make a KASSSERT out of a condition that can no longer occur.
MFC after: 1 week


# 0fe38d47 06-Sep-2004 Julian Elischer <julian@FreeBSD.org>

slight code cleanup

MFC after: 1 week


# bce73aed 05-Sep-2004 Julian Elischer <julian@FreeBSD.org>

turn on IPIs for 4bsd scheduler by default.

MFC after: 1 week


12345678910>>...18