summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_param.c
Commit message (Collapse)AuthorAgeFilesLines
* Change hw.physmem and hw.usermem to unsigned long like they used to bepeter2002-08-301-1/+1
| | | | | | | | | | | | | in the original hardwired sysctl implementation. The buf size calculator still overflows an integer on machines with large KVA (eg: ia64) where the number of pages does not fit into an int. Use 'long' there. Change Maxmem and physmem and related variables to 'long', mostly for completeness. Machines are not likely to overflow 'int' pages in the near term, but then again, 640K ought to be enough for anybody. This comes for free on 32 bit machines, so why not?
* Improve the implementation of adjtime(2).phk2002-04-151-2/+0
| | | | | | | | | | | | | | | | | | | | | | | Apply the change as a continuous slew rather than as a series of discrete steps and make it possible to adjust arbitraryly huge amounts of time in either direction. In practice this is done by hooking into the same once-per-second loop as the NTP PLL and setting a suitable frequency offset deducting the amount slewed from the remainder. If the remaining delta is larger than 1 second we slew at 5000PPM (5msec/sec), for a delta less than a second we slew at 500PPM (500usec/sec) and for the last one second period we will slew at whatever rate (less than 500PPM) it takes to eliminate the delta entirely. The old implementation stepped the clock a number of microseconds every HZ to acheive the same effect, using the same rates of change. Eliminate the global variables tickadj, tickdelta and timedelta and their various use and initializations. This removes the most significant obstacle to running timecounter and NTP housekeeping from a timeout rather than hardclock.
* Unconditionally limit maxproc so that it is not possiblesilby2002-03-071-0/+6
| | | | | | | | to exhaust all kmaps. The only reward for setting maxproc to a value which will cause kmap exhaustion is a panic during a forkbomb attack. MFC after: 3 days
* Allow the kern.maxusers boot tuneable to be set to 0 (previously onlydillon2002-02-061-2/+3
| | | | | | the kernel config's maxusers could be set to 0 for autosizing to work). Reviewed by: rwatson, imp MFC after: 3 days
* Make the 'maxusers 0' auto-sizing code slightly more conservative. Changedillon2002-01-251-3/+3
| | | | | | | | | | from 1 megabyte of ram per user to 2 megabytes of ram per user, and reduce the cap from 512 to 384. 512 leaves around 240 MB of KVM available while 384 leaves 270 MB of KVM available. Available KVM is important in order to deal with zalloc and kernel malloc area growth. Reviewed by: mckusick MFC: either before 4.5 if re's agree, or after 4.5
* Proper fix for old config setting maxusers to 8.peter2001-12-141-1/+1
|
* Too many people are compiling kernels with maxusers set to 0 without the newdillon2001-12-141-1/+1
| | | | config. Hack the kernel to force auto-sizing if the old config is used.
* Limit maxprocperuid to 9/10 maxproc, and limit maxfilesperproc to 9/10silby2001-12-131-2/+2
| | | | | | | maxfiles. This should make local resource exhaustion attacks easier to handle with a non-tweaked setup. MFC after: 3 days
* Allow maxusers to be specified as 0 in the kernel config, which willdillon2001-12-091-18/+40
| | | | | | | cause the system to auto-size to between 32 and 512 depending on the amount of memory. MFC after: 1 week
* Create a mutex pool API for short term leaf mutexes.dillon2001-11-131-8/+0
| | | | | Replace the manual mutex pool in kern_lock.c (lockmgr locks) with the new API. Replace the mutexes embedded in sxlocks with the new API.
* Make MAXTSIZ, DFLDSIZ, MAXDSIZ, DFLSSIZ, MAXSSIZ, SGROWSIZ loaderps2001-10-101-0/+21
| | | | | | | tunable. Reviewed by: peter MFC after: 2 weeks
* Conditionalize VM_SWZONE_SIZE_MAX and VM_BCACHE_SIZE_MAX so MD sectionsdillon2001-08-201-0/+4
| | | | that don't define these constants don't break.
* Limit the amount of KVM reserved for the buffer cache and for swap-metadillon2001-08-201-0/+6
| | | | | | | | | | | | | | | information. The default limits only effect machines with > 1GB of ram and can be overriden with two new kernel conf variables VM_SWZONE_SIZE_MAX and VM_BCACHE_SIZE_MAX, or with loader variables kern.maxswzone and kern.maxbcache. This has the effect of leaving more KVM available for sizing NMBCLUSTERS and 'maxusers' and should avoid tripups where a sysad adds memory to a machine and then sees the kernel panic on boot due to running out of KVM. Also change the default swap-meta auto-sizing calculation to allocate half of what it was previously allocating. The prior defaults were way too high. Note that we cannot afford to run out of swap-meta structures so we still stay somewhat conservative here.
* Move param.c out of the conf directory and make it fully dynamic.peter2001-07-261-27/+49
| | | | | | Tunables are now derived at boot time from maxusers. ie: change maxusers via a tunable and all the derivative settings change. You can change the other tunables individually as well. Even hz etc is tunable.
* Introduce numerous SMP friendly changes to the mbuf allocator. Namely,bmilekic2001-06-221-10/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | introduce a modified allocation mechanism for mbufs and mbuf clusters; one which can scale under SMP and which offers the possibility of resource reclamation to be implemented in the future. Notable advantages: o Reduce contention for SMP by offering per-CPU pools and locks. o Better use of data cache due to per-CPU pools. o Much less code cache pollution due to excessively large allocation macros. o Framework for `grouping' objects from same page together so as to be able to possibly free wired-down pages back to the system if they are no longer needed by the network stacks. Additional things changed with this addition: - Moved some mbuf specific declarations and initializations from sys/conf/param.c into mbuf-specific code where they belong. - m_getclr() has been renamed to m_get_clrd() because the old name is really confusing. m_getclr() HAS been preserved though and is defined to the new name. No tree sweep has been done "to change the interface," as the old name will continue to be supported and is not depracated. The change was merely done because m_getclr() sounds too much like "m_get a cluster." - TEMPORARILY disabled mbtypes statistics displaying in netstat(1) and systat(1) (see TODO below). - Fixed systat(1) to display number of "free mbufs" based on new per-CPU stat structures. - Fixed netstat(1) to display new per-CPU stats based on sysctl-exported per-CPU stat structures. All infos are fetched via sysctl. TODO (in order of priority): - Re-enable mbtypes statistics in both netstat(1) and systat(1) after introducing an SMP friendly way to collect the mbtypes stats under the already introduced per-CPU locks (i.e. hopefully don't use atomic() - it seems too costly for a mere stat update, especially when other locks are already present). - Optionally have systat(1) display not only "total free mbufs" but also "total free mbufs per CPU pool." - Fix minor length-fetching issues in netstat(1) related to recently re-enabled option to read mbuf stats from a core file. - Move reference counters at least for mbuf clusters into an unused portion of the cluster itself, to save space and need to allocate a counter. - Look into introducing resource freeing possibly from a kproc. Reviewed by (in parts): jlemon, jake, silby, terry Tested by: jlemon (Intel & Alpha), mjacob (Intel & Alpha) Preliminary performance measurements: jlemon (and me, obviously) URL: http://people.freebsd.org/~bmilekic/mb_alloc/
* Remove unneeded <stddef.h> #includes.phk2000-10-291-2/+0
|
* For lockmgr mutex protection, use an array of mutexes that are allocatedjasone2000-10-121-0/+8
| | | | | | | | | and initialized during boot. This avoids bloating sizeof(struct lock). As a side effect, it is no longer necessary to enforce the assumtion that lockinit()/lockdestroy() calls are paired, so the LK_VALID flag has been removed. Idea taken from: BSD/OS.
* Move the MSG* and SEM* options to opt_sysvipc.hpeter2000-05-011-45/+0
| | | | | | | | | | | | | | | Remove evil allocation macros from machdep.c (why was that there???) and use malloc() instead. Move paramters out of param.h and into the code itself. Move a bunch of internal definitions from public sys/*.h headers (without #ifdef _KERNEL even) into the code itself. I had hoped to make some of this more dynamic, but the cost of doing wakeups on all sleeping processes on old arrays was too frightening. The other possibility is to initialize on the first use, and allow dynamic sysctl changes to parameters right until that point. That would allow /etc/rc.sysctl to change SEM* and MSG* defaults as we presently do with SHM*, but without the nightmare of changing a running system.
* Make sysv-style shared memory tuneable params fully runtime adjustablepeter2000-03-301-33/+0
| | | | | | | | via sysctl. It's done pretty simply but it should be quite adequate. Also move SHMMAXPGS from $machine/include/vmparam.h as the comments that went with it were wrong... we don't allocate KVM space for the pages so that comment is bogus.. The only practical limit is how much physical ram you want to lock up as this stuff isn't paged out or swap backed.
* This is Bosko Milekic's mbuf allocation waiting code. Basically, thisgreen1999-12-121-0/+1
| | | | | | | | means that running out of mbuf space isn't a panic anymore, and code which runs out of network memory will sleep to wait for it. Submitted by: Bosko Milekic <bmilekic@dsuper.net> Reviewed by: green, wollman
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Move the initialisation/tuning of nmbclusters from param.c/machdep.cmsmith1999-07-051-17/+1
| | | | | | | | | | | | | | | into uipc_mbuf.c. This reduces three sets of identical tunable code to one set, and puts the initialisation with the mbuf code proper. Make NMBUFs tunable as well. Move the nmbclusters sysctl here as well. Move the initialisation of maxsockets from param.c to uipc_socket2.c, next to its corresponding sysctl. Use the new tunable macros for the kern.vm.kmem.size tunable (this should have been in a separate commit, whoops).
* Allow setting MAXFILES in the kernel config.des1999-04-091-1/+3
|
* Fixed problems with kernel config file overrides of sysv semaphoredillon1998-12-141-1/+3
| | | | | | | parameters. Prior to this fix a kernel config override would effect only some of the kernel files, resulting in panics. PR: kern/9068
* Implemented zero-copy TCP/IP extensions via sendfile(2) - send adg1998-11-051-1/+7
| | | | | | | | | | | file to a stream socket. sendfile(2) is similar to implementations in HP-UX, Linux, and other systems, but the API is more extensive and addresses many of the complaints that the Apache Group and others have had with those other implementations. Thanks to Marc Slemko of the Apache Group for helping me work out the best API for this. Anyway, this has the "net" result of speeding up sends of files over TCP/IP sockets by about 10X (that is to say, uses 1/10th of the CPU cycles) when compared to a traditional read/write loop.
* Moved definition of fscale from param.c to kern_synch.c where itbde1998-07-111-6/+1
| | | | | should always have been (it has no user-servicable parts even at compile time) and staticized it.
* Add 3 sysctl variables for future use by ps)1_phk1998-06-301-1/+4
|
* Round tickadj up. This prevents tickadj from being 0 when HZ > 500,bde1998-06-211-2/+2
| | | | | | | | | which makes adjtime(2) useless and confuses xntpd(8) into refusing to start even when it would use the kernel PLL instead of adjtime(). The result is the same as recommended by tickadj(8), at least when HZ divides 10^6. Of course, you wouldn't want to actually use adjtime() when HZ is large. In the silly boundary case of HZ == 10^6, tickadj == tick == 1 so the clock stops while adjtime() is active.
* Convert socket structures to be type-stable and add a version number.wollman1998-05-151-1/+8
| | | | | | | | | | | | | | | | | | | Define a parameter which indicates the maximum number of sockets in a system, and use this to size the zone allocators used for sockets and for certain PCBs. Convert PF_LOCAL PCB structures to be type-stable and add a version number. Define an external format for infomation about socket structures and use it in several places. Define a mechanism to get all PF_LOCAL and PF_INET PCB lists through sysctl(3) without blocking network interrupts for an unreasonable length of time. This probably still has some bugs and/or race conditions, but it seems to work well enough on my machines. It is now possible for `netstat' to get almost all of its information via the sysctl(3) interface rather than reading kmem (changes to follow).
* Raise ncallout from NPROC + 16 to NPROC + 16 + MAXFILES. This sholdguido1998-02-271-4/+5
| | | | | | prevent a possible DOS attack. The proper fix (to dynamically grow the callout list) is in the make. Submitted by: Paul Traina
* Removed unused #includes.bde1997-06-141-12/+1
|
* Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are notpeter1997-02-221-1/+1
| | | | ready for it yet.
* Removed option EXTRAVNODES. All versions of FreeBSD-2.x have a sysctlbde1997-01-161-5/+0
| | | | | | variable `kern.maxvnodes' which gives much better control over vnode allocation than EXTRAVNODES (except in -current between 1995/10/28 and 1996/11/12, kern.maxvnodes was read-only and thus useless).
* Fix bug related to map entry allocations where a sleep might be attempteddg1997-01-151-2/+2
| | | | | | | | when allocating memory for network buffers at interrupt time. This is due to inadequate checking for the new mcl_map. Fixed by merging mb_map and mcl_map into a single mb_map. Reviewed by: wollman
* Make the long-awaited change from $Id$ to $FreeBSD$jkh1997-01-141-1/+1
| | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise.
* Add an option "EXTRA_VNODES" to cause an extra number of vnode structurespeter1996-05-311-1/+6
| | | | | | | | | | | | | | | | to be allocated at boot time. This is an expensive option, as they consume physical ram and are not pageable etc. In certain situations, this kind of option is quite useful, especially for news servers that access a large number of directories at random and torture the name cache. Defining 5000 or 10000 extra vnodes should cut down the amount of vnode recycling somewhat, which should allow better name and directory caching etc. This is a "your mileage may vary" option, with no real indication of what works best for your machine except trial and error. Too many will cost you ram that you could otherwise use for disk buffers etc. This is based on something John Dyson mentioned to me a while ago.
* Allocate mbufs from a separate submap so that NMBCLUSTERS works aswollman1996-05-101-4/+6
| | | | expected.
* removed:phk1996-05-021-2/+2
| | | | | | | | | CLBYTES PD_SHIFT PGSHIFT NBPG PGOFSET CLSIZELOG2 CLSIZE pdei() ptei() kvtopte() ptetov() ispt() ptetoav() &c &c new: NPDEPG Major macro cleanup.
* First pass at cleaning up macros relating to pages, clusters and all that.phk1996-05-021-2/+2
|
* Merge in Lite2: proc LIST changes.hsu1996-03-111-27/+2
| | | | Reviewed by: david & bde
* Add more options into the conf/options and i386/conf/options.i386 filespeter1996-03-021-1/+2
| | | | | | and the #include hooks so that 'make depend' is more useful. This covers most of the options I regularly use (but not all) and some other easy ones.
* Convert SYSV IPC to new-style options. (I hope I got everything...)wollman1996-01-041-3/+5
| | | | The LKMs will need an extra file, to come later.
* Last commit this round: Staticize.phk1995-12-101-3/+1
| | | | | we are now down to about 1146 symbols being global, of which I estimate that about 100 are validly so.
* Eliminate sloppy common-style declarations. There should be none left forbde1995-07-291-6/+11
| | | | the LINT configuation.
* Removed "GATEWAY" consideration when calculating number of mbuf clusters.dg1995-06-291-5/+1
| | | | It now always uses the value that was used for the GATEWAY case.
* Killed "TIMEZONE" and "DST" options. They have been forced to 0 by configdg1995-06-291-3/+2
| | | | for more than a year now. Moved the declaration of 'tz' into kern_time.c.
* Made "NMBCLUSTERS" calculation dynamic and fixed bogus use of "NMBCLUSTERS"dg1995-05-251-2/+13
| | | | | | | | | | | | in machdep.c (it should use the global nmbclusters). Moved the calculation of nmbclusters into conf/param.c (same place where nmbclusters has always been assigned), and made the calculation include an extra amount based on "maxusers". NMBCLUSTERS can still be overrided in the kernel config file as always, but this change will make that generally unnecessary. This fixes the "bug" reports from people who have misconfigured kernels seeing the network "hang" when the mbuf cluster pool runs out. Reviewed by: John Dyson
* Implement maxprocperuid and maxfilesperproc. They are tunableguido1995-02-201-1/+3
| | | | | | | | | | | | via sysctl(8). The initial value of maxprocperuid is maxproc-1, that of maxfilesperproc is maxfiles (untill maxfile will disappear) Now it is at least possible to prohibit one user opening maxfiles -Guido Submitted by: Obtained from:
* Alow overriding of the various SHM* options.joerg1995-02-161-1/+11
| | | | Submitted by: Heikki Suonsivu <hsu@fx7.cs.hut.fi>
* Increase maxfiles to NPROC*2. This makes the per-process open file limitdg1995-01-121-2/+2
| | | | highly bogus, however, and this needs to be fixed.
OpenPOWER on IntegriCloud