aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/netstat/mbuf.c
Commit message (Collapse)AuthorAgeFilesLines
* Make the mb_alloc low-watermark sysctl-tunable read-only and makeBosko Milekic2003-05-151-0/+4
| | | | | | | | | | | netstat(1) not display it for now because its effects are not yet completely implemented and we're about to cut 5.2-RELEASE. This is temporary. Approved by: re (scottl, rwatson) Notes: svn path=/head/; revision=115037
* o Allow "buckets" in mb_alloc to be differently sized (according toBosko Milekic2003-02-201-33/+50
| | | | | | | | | | | | | | | | | | | compile-time constants). That is, a "bucket" now is not necessarily a page-worth of mbufs or clusters, but it is MBUF_BUCK_SZ, CLUS_BUCK_SZ worth of mbufs, clusters. o Rename {mbuf,clust}_limit to {mbuf,clust}_hiwm and introduce {mbuf,clust}_lowm, which currently has no effect but will be used to set the low watermarks. o Fix netstat so that it can deal with the differently-sized buckets and teach it about the low watermarks too. o Make sure the per-cpu stats for an absent CPU has mb_active set to 0, explicitly. o Get rid of the allocate refcounts from mbuf map mess. Instead, just malloc() the refcounts in one shot from mbuf_init() o Clean up / update comments in subr_mbuf.c Notes: svn path=/head/; revision=111164
* Warns cleanups for netstat:David Malone2002-09-051-4/+4
| | | | | | | | | | | | | | 1) Include arpa/inet.h for ntohs. 2) Constness fixes. 3) Fix shadowing except for "sin" which shouldn't be in scope. 4) Remove register keyword. 5) Add missing initialsers to user defined structs. 5) Make prototype of netname6 globally visable. 6) Use right macros for printing syncache stats (even though entrie isn't a word). Notes: svn path=/head/; revision=102975
* Re-enable mbtypes statistics in the mbuf allocator. I disabled theseBosko Milekic2001-09-301-45/+31
| | | | | | | | | | | | | | | | | | | | 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> Notes: svn path=/head/; revision=84153
* Add a "X KBytes of wired memory reserved" metric that representsBosko Milekic2001-07-311-11/+14
| | | | | | | | | | | | approximately the amount of memory allocated from the mbuf maps and sitting in the mbuf allocator's cache containers, and display in parantheses the percentage of said memory that is actually in use at the given time `netstat -m' is executed. Suggested by: mjacob Notes: svn path=/head/; revision=80720
* - Do not handle the per-CPU containers in mbuf code as though the cpuidsBosko Milekic2001-07-261-11/+7
| | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=80399
* - Fix space allocation for mbstat structureBosko Milekic2001-06-231-3/+5
| | | | | | | | - Make sure to try hw.ncpu if kern.smp.cpus doesn't exist (i.e. on UP) to get number of CPUs. Notes: svn path=/head/; revision=78665
* Introduce numerous SMP friendly changes to the mbuf allocator. Namely,Bosko Milekic2001-06-221-64/+163
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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/ Notes: svn path=/head/; revision=78592
* remove K&R supportAssar Westerlund2001-06-151-2/+1
| | | | Notes: svn path=/head/; revision=78314
* revert removal of warning and K&R supportAssar Westerlund2001-06-151-1/+2
| | | | | | | Requested by: bde Notes: svn path=/head/; revision=78309
* remove most of the warningsAssar Westerlund2001-06-151-2/+1
| | | | Notes: svn path=/head/; revision=78245
* Restore -M -N support for -m.Ruslan Ermilov2001-06-141-27/+44
| | | | | | | PR: 20808 Notes: svn path=/head/; revision=78219
* Change the "in use" percentage metric to actually display a realBosko Milekic2000-10-151-9/+14
| | | | | | | "in use" percentage. In other words, show how much of mb_map is in use. Notes: svn path=/head/; revision=67147
* Replace the mbuf external reference counting code with somethingDavid Malone2000-08-191-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | that should be better. The old code counted references to mbuf clusters by using the offset of the cluster from the start of memory allocated for mbufs and clusters as an index into an array of chars, which did the reference counting. If the external storage was not a cluster then reference counting had to be done by the code using that external storage. NetBSD's system of linked lists of mbufs was cosidered, but Alfred felt it would have locking issues when the kernel was made more SMP friendly. The system implimented uses a pool of unions to track external storage. The union contains an int for counting the references and a pointer for forming a free list. The reference counts are incremented and decremented atomically and so should be SMP friendly. This system can track reference counts for any sort of external storage. Access to the reference counting stuff is now through macros defined in mbuf.h, so it should be easier to make changes to the system in the future. The possibility of storing the reference count in one of the referencing mbufs was considered, but was rejected 'cos it would often leave extra mbufs allocated. Storing the reference count in the cluster was also considered, but because the external storage may not be a cluster this isn't an option. The size of the pool of reference counters is available in the stats provided by "netstat -m". PR: 19866 Submitted by: Bosko Milekic <bmilekic@dsuper.net> Reviewed by: alfred (glanced at by others on -net) Notes: svn path=/head/; revision=64837
* Make mbstat.m_mtypes seperate and viewable via sysctl, alsoAlfred Perlstein2000-07-151-25/+49
| | | | | | | | | | expand the size from short to ulong Submitted by: Ian Dowse <iedowse@maths.tcd.ie> PR: kern/19809 Notes: svn path=/head/; revision=63203
* Add display of maximum allowed mbuf count to match mbuf cluster count.Mike Smith1999-12-281-3/+11
| | | | | | | Submitted by: Bosko Milekic <bmilekic@dsuper.net> Notes: svn path=/head/; revision=55172
* $Id$ -> $FreeBSD$Peter Wemm1999-08-281-1/+1
| | | | Notes: svn path=/head/; revision=50477
* Fix "make world" breakage because MT_RTABLE was still referenced here.Ollivier Robert1999-01-181-1/+3
| | | | Notes: svn path=/head/; revision=42800
* Quick hack to allow netstat to compile once more: ifdef out MT_SOOPTSGary Palmer1998-08-231-1/+3
| | | | Notes: svn path=/head/; revision=38491
* Change a variable from int to size_t.John Birrell1998-08-181-3/+3
| | | | Notes: svn path=/head/; revision=38427
* Fixed printf format errors.Bruce Evans1998-07-061-4/+5
| | | | Notes: svn path=/head/; revision=37453
* mbuf, inet, and unix modules no longer read kvm.Garrett Wollman1998-05-151-3/+2
| | | | Notes: svn path=/head/; revision=36080
* Output mbuf clusters as current/peak/max. Requires new kern.ipc.nmbclustersDavid Greenman1998-04-241-5/+11
| | | | | | | sysctl variable (previously committed). Notes: svn path=/head/; revision=35414
* Add (unsigned) cast to prevent overflow in %Andrey A. Chernov1997-11-101-2/+2
| | | | | | | Submitted by: "Alex G. Bulushev" <bag@demos.su> Notes: svn path=/head/; revision=31097
* Bandaid to make this compile.. These old mbuf types should probably bePeter Wemm1997-08-171-1/+13
| | | | | | | ripped out. Notes: svn path=/head/; revision=28284
* Remove prog, unused variables.Philippe Charnier1997-07-291-0/+5
| | | | | | | Cosmetic in usage string. Notes: svn path=/head/; revision=27753
* Use the new sysctl(3) interface to mbuf statistics rather thanGarrett Wollman1997-02-241-7/+19
| | | | | | | groveling about in kmem. Notes: svn path=/head/; revision=23086
* When the mbuf code was changed to use a private allocator instead ofGarrett Wollman1997-02-121-3/+4
| | | | | | | | | | the kernel malloc, netstat was never updated to reflect the fact that there are once again allocated-but-free mbufs, just as there are clusters, and so the information presented about how much memory was allocated to the network was bogus. Fixed. Notes: svn path=/head/; revision=22615
* Code cleanup: remove unused variables, use correct *printf formatAlexander Langer1996-06-021-4/+4
| | | | | | | | | specifiers (some unsigned values were printed as signed, some longs were printed as ints), and place parentheses around assignments in if statements. Notes: svn path=/head/; revision=16080
* Changed "mapped pages in use" to "mbuf clusters in use".David Greenman1995-02-231-1/+1
| | | | Notes: svn path=/head/; revision=6668
* Don't print protocol-cloned routes by default (enabled by -a flag).Garrett Wollman1995-01-231-3/+2
| | | | | | | | Print non-zero expiration timers. Use err(3) for error reporting. Notes: svn path=/head/; revision=5811
* BSD 4.4 Lite Usr.bin SourcesRodney W. Grimes1994-05-271-0/+122
Notes: svn path=/cvs2svn/branches/CHRISTOS/; revision=1590