Commit Graph

50 Commits

Author SHA1 Message Date
itojun f5fa53578a repair m_dup(). specifically, now it is safe against non-MCLBYTES cluster
mbuf.  noone seem to be using this function at this moment.
2000-08-18 16:19:22 +00:00
itojun 243eebc256 disable m_dup(), as it makes false assumption on cluster mbuf and unsafe
(does not do the right thing).
2000-08-18 14:23:48 +00:00
itojun 1905ac079e add a comment about false assumption made by m_dup() 2000-08-18 14:12:47 +00:00
mrg 32aa199ccf remove include of <vm/vm.h> 2000-06-27 17:41:07 +00:00
mrg 2f159a1bac remove/move more mach vm header files:
<vm/pglist.h> -> <uvm/uvm_pglist.h>
	<vm/vm_inherit.h> -> <uvm/uvm_inherit.h>
	<vm/vm_kern.h> -> into <uvm/uvm_extern.h>
	<vm/vm_object.h> -> nothing
	<vm/vm_pager.h> -> into <uvm/uvm_pager.h>

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.
2000-06-26 14:20:25 +00:00
itojun 04ac848d6f introduce m->m_pkthdr.aux to hold random data which needs to be passed
between protocol handlers.

ipsec socket pointers, ipsec decryption/auth information, tunnel
decapsulation information are in my mind - there can be several other usage.
at this moment, we use this for ipsec socket pointer passing.  this will
avoid reuse of m->m_pkthdr.rcvif in ipsec code.

due to the change, MHLEN will be decreased by sizeof(void *) - for example,
for i386, MHLEN was 100 bytes, but is now 96 bytes.
we may want to increase MSIZE from 128 to 256 for some of our architectures.

take caution if you use it for keeping some data item for long period
of time - use extra caution on M_PREPEND() or m_adj(), as they may result
in loss of m->m_pkthdr.aux pointer (and mbuf leak).

this will bump kernel version.

(as discussed in tech-net, tested in kame tree)
2000-03-01 12:49:27 +00:00
itojun b7f47adef9 add mbuf deep-copy fnudtion, m_dup().
NOTE: if you use m_dup(), your additional kernel code can become
incompatible with 4.xBSD or other *BSD.
1999-10-27 14:23:26 +00:00
thorpej 428443a130 Add some more diagnostic information to the 3 different `panic("m_copym")'
calls.
1999-08-05 02:24:29 +00:00
thorpej 3d23eb3ce3 More improvements to mbuf and mbuf cluster allocation:
- Initialize mbpool and mclpool with msize and mclbytes, respectively,
so that those values may be patched and have an actual affect on the
next system reboot.

- Set low water marks on mbpool (default: 16) and mclpool (default: 8).
This should be of great help for diskless systems, which need to allocate
mbufs in order to clean dirty pages; the low water marks increase the
chances of this being possible to do in memory starvation situations.

- Add support for getting/setting some mbuf-related parameters via sysctl.
* msize and mclsize (read-only)
* nmbclusters (read-only unless the platform has direct-mapped pool pages,
in which case the value can be increased).
* mblowat and mcllowat (read/write)
1999-04-26 22:04:28 +00:00
simonb a560bdeeec Use the nmbclusters variable and not the NMBCLUSTERS constant when setting
the mclpool hardlimit.
1999-04-25 03:03:03 +00:00
thorpej 4fd2edfbe8 mbinit() can now allocate memory. Update a comment accordingly. 1999-04-01 00:23:25 +00:00
thorpej 98d006d2c6 Set a hard limit (rather than an advisory high water mark for pages) of
NMBCLUSTERS for the mbuf cluster pool.  On platforms which use direct-mapped
segments for pool pages (MIPS and Alpha), this makes NMBCLUSTERS actually
meaningful (such ports don't even allocate mb_map, as it is not used to
map mbuf cluster pages).

Improve the message logged at a maximum rate of once per second.  The
new message: "WARNING: mclpool limit reached; increase NMBCLUSTERS".

In the back-end pool page allocator, remove the message about mb_map
being full.  The message was not necessarily correct as the allocator
may have been starved for pages, rather than for space in the map.  Also,
the hard limit on the mbuf cluster pool will be reached before the map
fills (the last cluster will always fit into the map), so the message
is redundant.

Add a comment in mbinit() about considering setting low water marks on
the mbuf and mbuf cluster pools.
1999-03-31 01:26:40 +00:00
mrg d2397ac5f7 completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
1999-03-24 05:50:49 +00:00
thorpej 845b609f97 Set the high water mark on the mbuf cluster pool to NMBCLUSTERS. 1999-03-23 02:51:27 +00:00
thorpej f2a91c9b91 Put back the code to log `mb_map full' that was lost when mbuf clusters
were converted to use the pool allocator.
1999-03-22 22:06:58 +00:00
thorpej e598335d1c Garbage-collect `mbutl'. 1999-01-09 22:10:12 +00:00
thorpej 99d93cb85e Garbage-collect `union mcluster' and `mclfree'. 1999-01-09 21:54:07 +00:00
thorpej 489d6d0e46 Reverse the stopgap change made in revision 1.29:
date: 1998/08/01 01:47:24;  author: thorpej;  state: Exp;  lines: +18 -8
Don't call the protocol drain routines if how == M_NOWAIT, which typically
means we're in interrupt context.  Since we can be called from a network
hardware interrupt, we could corrupt the protocol queues we try to drain
them at that time.

The problem has been addressed by letting the drain'able protocols use
a locking scheme to prevent queue corruption.
1998-12-18 21:40:14 +00:00
thorpej 77d0a69569 Add a waitok boolean argument to the VM system's pool page allocator backend. 1998-08-28 20:05:48 +00:00
thorpej 09efdbb42d Oops, this got missed in the vm_offset_t -> vaddr_t change. 1998-08-13 19:15:33 +00:00
perry 275d1554aa Abolition of bcopy, ovbcopy, bcmp, and bzero, phase one.
bcopy(x, y, z) ->  memcpy(y, x, z)
ovbcopy(x, y, z) -> memmove(y, x, z)
   bcmp(x, y, z) ->  memcmp(x, y, z)
  bzero(x, y)    ->  memset(x, 0, y)
1998-08-04 04:03:10 +00:00
thorpej 3c658f1f41 Don't call the protocol drain routines if how == M_NOWAIT, which typically
means we're in interrupt context.  Since we can be called from a network
hardware interrupt, we could corrupt the protocol queues we try to drain
them at that time.
1998-08-01 01:47:24 +00:00
thorpej e7521693c1 Use the pool allocator for mbufs and mbufs clusters (two pools, one for
each).  Partially from pk@netbsd.org.
1998-08-01 01:35:20 +00:00
matt b2c24dbcbe Add an if_drain to the ifnet structure (call when the system is low
on mbufs).  Add code to m_reclaim to call if_drain in each ifnet
that has one set.  Remove register from declarations.
1998-05-22 17:47:21 +00:00
fvdl e5bc90f40c Merge with Lite2 + local changes 1998-03-01 02:20:01 +00:00
kleink 0dc9b5452d Fix variable declarations: register -> register int. 1998-02-12 20:39:41 +00:00
mrg d90485202c - add defopt's for UVM, UVMHIST and PMAP_NEW.
- remove unnecessary UVMHIST_DECL's.
1998-02-10 14:08:44 +00:00
mrg 1a8c7604f4 initial import of the new virtual memory system, UVM, into -current.
UVM was written by chuck cranor <chuck@maria.wustl.edu>, with some
minor portions derived from the old Mach code.  i provided some help
getting swap and paging working, and other bug fixes/ideas.  chuck
silvers <chuq@chuq.com> also provided some other fixes.

this is the rest of the MI portion changes.

this will be KNF'd shortly.  :-)
1998-02-05 07:59:28 +00:00
thorpej e78682a0e2 In m_split(), restore m_pkthdr.len if an error occurs. From Koji Imada,
PR #3986.
1997-11-20 04:28:18 +00:00
pk f910dab2bd Get `canwait' argument to kmem_malloc() right. 1997-06-06 10:51:49 +00:00
mycroft 103c7d360d Oops; forgot to GC the last mbuf allocated when out of clusters. 1997-04-28 17:03:58 +00:00
mycroft 9da4efe896 If we fail to allocate a cluster to hold a large packet, simply
drop it rather than using a chain of tiny mbufs.
1997-04-24 08:14:04 +00:00
thorpej 2a4b742e6a Update and enhancement to the mbuf code, to support use of non-cluster
external storage.  Highlights:

	- additional "void *" argument to (*ext_free)(), an opaque
	  cookie for use by the free function.
	- MCLALLOC() and MCLFREE() calls are gone.  They are replaced
	  by MEXTADD() (add external storage to mbuf), MEXTMALLOC()
	  (malloc() external storage and attach to mbuf), and
	  MEXTREMOVE() (remove external storage from mbuf).
	- completely new external storage reference counting
	  mechanism; mclrefcnt[] is gone.

These changes will eventually be used to pass driver DMA buffers up
the network stack, and reduce/eliminate copies in certain code paths
(e.g. NFS writes).

From Matt Thomas <matt@3am-software.com> and myself <thorpej@nas.nasa.gov>,
with some input from Chris Demetriou <cgd@cs.cmu.edu> and review by
Charles Hannum <mycroft@mit.edu>.
1997-03-27 20:33:07 +00:00
gwr 6dba055937 Move `static' to the beginning of the storage class specifiers. 1996-12-18 20:24:50 +00:00
cgd 1abc77f86d if kmem_malloc() fails while trying to allocate an mbuf cluster, try
and free some space by calling m_reclaim().  Also, log the "mb_map full"
error message (at most) every 60-seconds.  The old code would log it
once over the lifetime of the system, but that's not a useful diagnostic.
(More useful is the new behaviour, which roughly indicates how often
periods of heavy load occur, without spamming the console and system
logs with messages.)
1996-06-13 17:02:23 +00:00
christos 09afd77655 More proto fixes 1996-02-09 18:59:18 +00:00
christos e630447d8c First pass at prototyping 1996-02-04 02:17:43 +00:00
cgd 6ac2bbfc35 be more careful with types, also pull in headers where necessary. 1994-10-30 21:43:03 +00:00
deraadt 9d7bdbb0c4 don't play with CLBYTES in cpp 1994-09-28 00:44:30 +00:00
mycroft 0874e14c94 m_adj() returns void. 1994-09-19 08:07:17 +00:00
cgd cf92afd66e New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD' 1994-06-29 06:29:24 +00:00
mycroft d361acde18 Update to 4.4-Lite networking code, with a few local changes. 1994-05-13 06:01:27 +00:00
deraadt 0f8b2efbad the packet header is at the start of the mbuf chain, not the end. 1994-04-14 21:34:17 +00:00
mycroft 155811b49c #include vm_kern.h. 1994-01-08 05:29:15 +00:00
mycroft 7f50bd1829 Canonicalize all #includes. 1993-12-18 04:21:37 +00:00
cgd ce7108c729 slightly clean up ws's original patch to this file for the sense
of wait vs. nowait.  this patch from torek.
1993-10-22 02:48:35 +00:00
jtc 9c00bc072d Include systm.h to get prototypes (and possibly inlines) of *max functions.
Change mbinit() to match prototype.
1993-09-04 00:01:43 +00:00
cgd 230dcf0d05 add $Id$ strings, and clean up file headers where necessary 1993-05-20 02:54:09 +00:00
cgd e541169ce2 after 0.2.2 "stable" patches applied 1993-03-21 18:04:42 +00:00
cgd 61f282557f initial import of 386bsd-0.1 sources 1993-03-21 09:45:37 +00:00