summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_mbuf.c
Commit message (Collapse)AuthorAgeFilesLines
* m_extadd takes a void (*freef)(void *, void *) now, not aalfred2002-06-291-1/+1
| | | | void (*freef)(caddr_t, void *).
* Set system_map for both mbuf_map and clust_map to 1, in mbuf_init().bmilekic2002-06-131-2/+4
| | | | | Submitted by: Tor Egge (tegge) Pointed out to me by: hsu
* Separate "seperate" from kernel source.eric2002-05-161-1/+1
|
* Remove a printf(3) argument with no corresponding format specifier.des2002-05-141-1/+1
|
* Change the mbuf exhaustion warning message to match the messagesilby2002-05-091-1/+2
| | | | in -stable.
* Change callers of mtx_init() to pass in an appropriate lock type name. Injhb2002-04-041-2/+2
| | | | | | | most cases NULL is passed, but in some cases such as network driver locks (which use the MTX_NETWORK_LOCK macro) and UMA zone locks, a name is used. Tested on: i386, alpha, sparc64
* Fix bug in mb_alloc that made systems configured withbmilekic2002-03-031-3/+1
| | | | | | | | | | PAGE_SIZE / MCLBYTES == 1 crash. Fix them by changing the appropriate "allocate new page and bucket" code in mb_alloc to use the macro for properly grabbing an allocated object from a bucket, the one that checks whether the bucket is empty. This should allow ken to continue testing zero-copy stuff on -CURRENT. Noticed and provided debug info: ken
* On the first day of Christmas bde gave to me:bmilekic2001-12-231-143/+132
| | | | | | | | A [hopefully] conforming style(9) revamp of mb_alloc and related code. (This was possible due to bde's remarkable patience.) Submitted by: (in large part) bde Reviewed by: (the other part) bde
* Move prototype of _mext_free to mbuf.h, where it belongs, because it isbmilekic2001-12-221-1/+0
| | | | | | | used in MEXTFREE and needs to be in scope for external MEXTFREE users. Pointed out by: Chad David <davidc@acns.ab.ca> Confirmed by: bde
* vm/vm_kern.c: rate limit (to once per second) diagnostic printf whenluigi2001-12-011-1/+14
| | | | | | | | | | | | | | | | | | | | | you run out of mbuf address space. kern/subr_mbuf.c: print a warning message when mb_alloc fails, again rate-limited to at most once per second. This covers other cases of mbuf allocation failures. Probably it also overlaps the one handled in vm/vm_kern.c, so maybe the latter should go away. This warning will let us gradually remove the printf that are scattered across most network drivers to report mbuf allocation failures. Those are potentially dangerous, in that they are not rate-limited and can easily cause systems to panic. Unless there is disagreement (which does not seem to be the case judging from the discussion on -net so far), and because this is sort of a safety bugfix, I plan to commit a similar change to STABLE during the weekend (it affects kern/uipc_mbuf.c there). Discussed-with: jlemon, silby and -net
* Context:bmilekic2001-11-251-1/+2
| | | | | | | | | | | | | | | | | | For an object type, we maintain a variable mb_mapfull. It is 0 by default and is only raised to 1 in one place: when an mb_pop_cont() fails for the first time, on the assumption that the reason for the failure is due to the underlying map for the object (e.g. clust_map, mbuf_map) being exhausted. Problem and Changes: Change how we define "mb_mapfull." It now means: "set to 1 when the first mb_pop_cont() fails only in the kmem_malloc()-ing of the object, and only if the call was with the M_TRYWAIT flag." This is a more conservative definition and should avoid odd [but theoretically possible] situations from occuring. i.e. we had set mb_mapfull to 1 thinking the map for the object was actually exhausted when we _actually_ failed in malloc()ing the space for the bucket structure managing the objects in the page we're allocating.
* Re-enable mbtypes statistics in the mbuf allocator. I disabled thesebmilekic2001-09-301-13/+71
| | | | | | | | | | | | | | | | | when I changed the allocator bits. This implements per-CPU mbtypes stats by keeping net number of decrements/increments of a given mbtype per-CPU and then summing all of the per-CPU mbtypes to produce the total net number of allocated mbufs of the given mbtype. Counters are carefully balanced to avoid/prevent underflows/overflows. mbtypes stats are re-enabled with the idea that we may occasionally (although very rarely) observe slight inconsistencies in the stat reporting. Most of the time, we should be fine, though. Also make appropriate modifications to netstat(1) and systat(1) to do the necessary reporting. Submitted by: Jiangyi Liu <jyliu@163.net>
* KSE Milestone 2julian2001-09-121-1/+1
| | | | | | | | | | | | | | Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha
* Rename mb_init() mbuf subsystem initialization routine to mbuf_init(), inbmilekic2001-08-031-4/+4
| | | | | | | | order to avoid namespace collision with subr_mchain.c's mb_init(). This wasn't "fatal" as the mbuf initialization routine mb_init() was local to subr_mbuf.c which in turn didn't pull in subr_mchain.c's mb_init() declaration, but it should deffinately be changed now before it creates headache.
* Move CPU_ABSENT() macro to smp.h, where it belongs anyway. It will bebmilekic2001-08-011-15/+4
| | | | | | | | | | | defined to 0 in the non-SMP case, which very much makes sense as it permits its usage in per-CPU initialization loops (for an example, check out subr_mbuf.c). Further, on a UP system, make mb_alloc always use the first per-CPU container, regardless of cpuid (i.e. remove reliability on cpuid in the UP case). Requested by: alfred
* Use the tunable maxusers rather than the compile-time one. Evaluate andpeter2001-07-261-12/+18
| | | | | | initialize in the right order to make derivative settings work right. eg: at compile time, nmbufs was double nmbclusters. For POLA this should work the same at runtime.
* - Do not handle the per-CPU containers in mbuf code as though the cpuidsbmilekic2001-07-261-6/+23
| | | | | | | | | | | | | | | | | were indices in a dense array. The cpuids are a sparse set and treat them as such, setting up containers only for CPUs activated during mb_init(). - Fix netstat(1) and systat(1) to treat the per-CPU stats area as a sparse map, in accordance with the above. This allows us to properly boot with certain CPUs disactivated. However, if we later decide to re-activate said CPUs, we will barf until we decide to implement CPU spinon/spinoff callback hooks to allow for said CPUs' per-CPU containers to get configured on their activation. Reported by: mjacob Partially (sys/ diffs) Submitted by: mjacob
* Increase NMBCLUSTERS by 4x.obrien2001-07-171-1/+1
| | | | This takes a GENERIC kernel (MAXUSERS=32) from 1536 to 3072.
* Temporary fix at least- define NCPU_PRESENT which will be mp_npcus formjacob2001-06-221-2/+11
| | | | SMP kernels, one (1) for non-SMP.
* Introduce numerous SMP friendly changes to the mbuf allocator. Namely,bmilekic2001-06-221-0/+1029
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/
OpenPOWER on IntegriCloud