Commit Graph

5902 Commits

Author SHA1 Message Date
tjr
b6e7b5a1a2 No need to lock Giant around call to nanosleep1() in nanosleep(). 2003-02-03 15:31:57 +00:00
tjr
7fd7c82761 Avoid holding Giant across copyout() in gettimeofday() and getitimer(). 2003-02-03 14:47:22 +00:00
harti
3fe8dc7ecf Make the variable types, the sysctl macros and the sysctl handler for
kern.ipc.{maxsockbuf,sockbuf_waste_factor} to agree that those variables
are of type unsigned long.

PR:		sparc64/47389
Approved by:	jake (mentor)
2003-02-03 06:50:59 +00:00
jeff
d73f4537e9 - Make some context switches conditional on SCHED_STRICT_RESCHED. This may
have some negative effect on interactivity but it yields great perf. gains.
   This also brings the conditions under which ULE context switches inline
   with SCHED_4BSD.
 - Define some new kseq_* functions for manipulating the run queue.
 - Add a new kseq member ksq_rslices and ksq_bload.  rslices is the sum of
   the slices of runnable kses.  This will be used for push load balance
   decisions.  bload is the number of threads blocked waiting on IO.
2003-02-03 05:30:07 +00:00
jeff
c6d199a14d - Stop abusing oncpu for our cpu binding. Define a scheduler local element
in the kse datastructure called ke_cpu.  This is the cpu which we are
   currently bound to.  Some flags may be added later to support hard binding.
2003-02-03 02:26:28 +00:00
alfred
86daf0cca6 Catch more uses of MIN(). 2003-02-02 13:30:00 +00:00
alfred
b5c0015ac9 Consolidate MIN/MAX macros into one place (param.h).
Submitted by: Hiten Pandya <hiten@unixdaemons.com>
2003-02-02 13:17:30 +00:00
scottl
c0109dece2 Use hz if stathz is zero. Adopted from sched_4bsd. 2003-02-02 08:24:32 +00:00
julian
e8efa7328e Reversion of commit by Davidxu plus fixes since applied.
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.
2003-02-01 12:17:09 +00:00
phk
7f4da3a28c Under #ifdef DIAGNOSTIC, fill malloc(9) allocations which do not have
M_ZERO specified with 0x70.  (malloc_flags=J for the kernel :-)
2003-02-01 10:07:49 +00:00
phk
2f5b4a19f3 Under DIAGNOSTIC, only report expensive timeouts if they are more expensive
than the last on we reported.
2003-02-01 10:06:40 +00:00
julian
2fe4ecbd6c Only add one tick per tick to the thread stats, instead of some random number. 2003-01-31 22:14:46 +00:00
rwatson
e9e0de5ca4 Correct handling of locking for chroot() and chdir() cases: rather
than having change_dir() release the vnode lock on success, hold the
lock so that we can use it later when invoking MAC checks and
VOP_ACCESS() in the chroot() code.  Update the comment to reflect
this calling convention.  Update callers to unlock the vnode
lock.  Correct a typo regarding vnode naming in the MAC case that
crept in via the previous patch applied.
2003-01-31 21:13:25 +00:00
rwatson
21c1d8195b Clean up vnode handling on return from chroot() in certain error
cases: we might multiply vrele() a vnode when certain classes of
failures occur.  This appears to stem from earlier Giant/file
descriptor lock pushdown and restructuring.

Submitted by:	maxim
2003-01-31 18:57:04 +00:00
tjr
e3277471d4 Use a local variable to store the number of ticks that elapsed in
kernel mode instead of (unintentionally) using the global `ticks'.
This error completely broke profiling.
2003-01-31 11:22:31 +00:00
phk
0d05e0d7d3 NO_GEOM cleanup: unifdef; 2003-01-30 19:22:27 +00:00
phk
e686a54f84 NO_GEOM cleanup: retire to attic. 2003-01-30 12:58:55 +00:00
phk
420d58667b NODEVFS cleanup: Unifdef. 2003-01-30 12:51:32 +00:00
phk
406e155335 NO_GEOM cleanup: remove #ifdef 2003-01-30 12:36:30 +00:00
phk
04c4fc0788 NODEVFS cleanup: remove #ifdefs 2003-01-30 12:35:40 +00:00
phk
9f5bb44936 NODEVFS cleanup: remove #ifdefs. 2003-01-30 12:35:17 +00:00
phk
c356612ab4 NODEVFS cleanup: Remove cdevsw[].
This implicitly removes the need for major numbers, but a number of
drivers still know things they shouldn't need to, and we need to
consider if there are applications which cache major(+minor) gleaned
from stat(2) and rely on it being constant over reboots before we
start assigning random majors.
2003-01-29 21:54:03 +00:00
tjr
0a4a086e25 Fix two fatal signedness errors introduced when i and j in semop()
were changed from int to size_t in the previous revision.

PR:		47625
2003-01-29 12:30:59 +00:00
phk
13e0104093 Move timecounters notion of frequency to 64 bits.
[WARNING: CPUs in the distant future may be closer than they appear!]
2003-01-29 11:29:22 +00:00
jeff
aecaf33831 - Use ksq_load as the authoritive count of kses on the pair of kseqs for
sched_runnable() et all.
 - Remove some dead code in sched_clock().
 - Define two macros KSEQ_SELF() and KSEQ_CPU() for getting the kseq of the
   current cpu or some alternate cpu.
 - Start introducing kseq_() functions, such as kseq_choose() and kseq_setup().
2003-01-29 07:00:51 +00:00
jeff
493b743362 - Remove debugging code that didn't work on UP. 2003-01-29 00:26:47 +00:00
jeff
ea90c5e5d4 - Allow idle's pctcpu time to be calculated. 2003-01-28 09:30:17 +00:00
jeff
4b57d52c50 - Fix the ksq_load calculation. It now reflects the number of entries on the
run queue for each cpu.
 - Introduce kse stealing into the sched_choose() code.  This helps balance
   cpus better in cases where process turnover is high.  This implementation
   is fairly trivial and will likely be only a temporary measure until
   something more sophisticated has been written.
2003-01-28 09:28:20 +00:00
peter
d7e400a15f No longer force COMPAT_FREEBSD4 to be on. 2003-01-27 23:01:03 +00:00
phk
3b4c6dba65 Don't dereference null vnode pointer if controling terminal was revoked.
Submitted by:	"Peter Edwards" <pmedwards@eircom.net>
2003-01-27 16:54:17 +00:00
davidxu
d7d17fc4e6 Use kg_numupcalls to see if we are closing a thread group,
not kg_kses which is not changed when a group is still working.
2003-01-26 23:39:33 +00:00
alfred
3d1537da2b fix warnings 2003-01-26 23:25:00 +00:00
alfred
1cd571649a Add const qualifier to data argument for msgsnd.
PR: standards/45274
Submitted by: Craig Rodrigues <rodrigc@attbi.com>
2003-01-26 20:09:34 +00:00
davidxu
4b9b549ca2 Move UPCALL related data structure out of kse, introduce a new
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
2003-01-26 11:41:35 +00:00
jeff
f8d3c4423d - Add the ule scheduler. This is intended to be a general purpose process
scheduler with many SMP benefits.  It is still very experimental and should
   be used only in test environments.
2003-01-26 05:23:15 +00:00
jeff
7e4b46c64e - Call sched_sleep() instead of rolling our own in cv_waitq_add(). 2003-01-26 04:00:39 +00:00
alfred
28e8e60e36 Bring shm functions closer the the opengroup standards.
PR: 47469
Submitted by: Craig Rodrigues <rodrigc@attbi.com>
2003-01-25 21:33:05 +00:00
alfred
cea829ec35 Bring semop() closer the the opengroup standards.
PR: 47471
Submitted by: Craig Rodrigues <rodrigc@attbi.com>
2003-01-25 21:27:37 +00:00
phk
bd84d01eea Add sysctl kern.timecounter.nsetclock which indicates the number of
potential discontinuities in our UTC timescale.

Applications can monitor this variable if they want to be informed
about steps in the timescale.  Slews (ntp and adjtime(2)) and
frequency adjustments (ntp) will not increment this counter, only
operations which set the clock.  No attempt is made to classify
size or direction of the step.
2003-01-25 07:51:09 +00:00
hsu
2d948f2956 Remove extraneous FILEDESC_LOCKs around atomic reads.
Reviewed by:	jhb
2003-01-24 22:49:52 +00:00
ume
c0c74b0e19 Added comment why this workaround is required.
Suggested by:	sam
MFC after:	1 week
2003-01-22 18:03:06 +00:00
ume
7040970198 getpeername() returns with no error but didn't fill struct sockaddr
correctly against PF_LOCAL.  It seems that the test always fails then
sockaddr was not filled.  So, I added else clause for workaround.
I doubt if it is right fix.  However, it is better than nothing.  I
found that NetBSD has same potential problem.  But, fortunately,
NetBSD has equivalent else clause.

MFC after:	1 week
2003-01-22 13:13:13 +00:00
des
ae16fa6bfb There's absolutely no need for a struct-within-a-struct, so move the
counters out of the inner struct and remove it.
2003-01-21 20:33:27 +00:00
hsu
95173465f5 Add missing SMP file locks around read-modify-write operations on
the flag field.

Reviewed by:	rwatson
2003-01-21 20:20:48 +00:00
tmm
1c8eb2eca7 Correct an off-by-one in the boundary check. Otherwise, resource
allocations would fail if the desired allocation size was equal to
the boundary.
2003-01-21 17:02:21 +00:00
phk
9b09eee706 #ifdef NO_GEOM all of this file. 2003-01-21 10:40:46 +00:00
alfred
bf8e8a6e8f Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
2003-01-21 08:56:16 +00:00
sam
c3419c219e preserve the order of tags copied by m_tag_copy_chain
Obtained from:	OpenBSD
2003-01-21 06:14:38 +00:00
hsu
34eb753e79 Rewrite the SMP filedesc locking in knote_attach() in order to
1.  eliminate unnecessary loop which frees and re-allocates
	the just allocated array
  2.  eliminate the newsize recomputation
  3.  eliminate unnecessary unlock and relock around free
  4.  correctly match the free with the malloc into M_KQUEUE instead of M_TEMP
  5.  eliminate conditional assignment of oldlist, which is equivalent to a
	simple assignment
  6.  eliminate the oldlist temporary variable completely

Reviewed by:    jhb
2003-01-21 04:05:49 +00:00
rwatson
990294caa2 Perform VOP_GETATTR() before mac_check_vnode_exec() so that
the cached attributes are available to MAC modules.

Submitted by:   mike halderman <mrh@nosc.mil>
Obtained from:	TrustedBSD Project
2003-01-21 03:26:28 +00:00