aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/malloc.h
Commit message (Collapse)AuthorAgeFilesLines
* Remove advertising clause from University of California Regent's license,Warner Losh2004-04-071-4/+0
| | | | | | | | | per letter dated July 22, 1999. Approved by: core Notes: svn path=/head/; revision=127976
* correct typo in commentSam Leffler2003-08-191-1/+1
| | | | Notes: svn path=/head/; revision=119129
* - Add vm_paddr_t, a physical address type. This is required for systemsJake Burkholder2003-03-251-1/+1
| | | | | | | | | | | | | | | | | | where physical addresses larger than virtual addresses, such as i386s with PAE. - Use this to represent physical addresses in the MI vm system and in the i386 pmap code. This also changes the paddr parameter to d_mmap_t. - Fix printf formats to handle physical addresses >4G in the i386 memory detection code, and due to kvtop returning vm_paddr_t instead of u_long. Note that this is a name change only; vm_paddr_t is still the same as vm_offset_t on all currently supported platforms. Sponsored by: DARPA, Network Associates Laboratories Discussed with: re, phk (cdevsw change) Notes: svn path=/head/; revision=112569
* Make malloc and mbuf allocation mode flags nonoverlapping.Poul-Henning Kamp2003-03-101-4/+4
| | | | | | | | | Under INVARIANTS whine if we get incompatible flags. Submitted by: imp Notes: svn path=/head/; revision=112063
* GC M_STRING, no longer required as strdup() accepts a malloc type.Robert Watson2003-02-261-1/+0
| | | | | | | Requested by: phk Notes: svn path=/head/; revision=111516
* Add an implementation of strdup() to libkern. Allocated memory is ofRobert Watson2003-02-231-0/+1
| | | | | | | | | | | | type M_STRING, now defined in malloc.h. Useful when string parsing must occur using the kernel strsep() and we want to avoid toasting the source string. Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories Notes: svn path=/head/; revision=111317
* Back out M_* changes, per decision of the TRB.Warner Losh2003-02-191-2/+1
| | | | | | | Approved by: trb Notes: svn path=/head/; revision=111119
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.Alfred Perlstein2003-01-211-1/+2
| | | | | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT. Notes: svn path=/head/; revision=109623
* Introduce malloc_last_fail() which returns the number of seconds sincePoul-Henning Kamp2002-11-011-0/+1
| | | | | | | | | | | | malloc(9) failed last time. This is intended to help code adjust memory usage to the current circumstances. A typical use could be: if (malloc_last_fail() < 60) reduce_cache_by_one(); Notes: svn path=/head/; revision=106305
* Garbage-collected splmem.Bruce Evans2002-09-151-7/+5
| | | | | | | | | | Moved the declaration of malloc_mtx to be with the other extern declarations and not exposed to userland. Fixed some minor style bugs. Notes: svn path=/head/; revision=103351
* Removed most namespace pollution in this header: don't include <vm/uma.h>;Bruce Evans2002-09-151-3/+3
| | | | | | | | include <sys/_mutex.h> and its prerequisites instead of <sys/mutex.h> and its prerequisite. Notes: svn path=/head/; revision=103349
* fix whitespace botch in previous commit.Bill Fumerola2002-06-191-1/+1
| | | | Notes: svn path=/head/; revision=98406
* - Introduce the new M_NOVM option which tells uma to only check the currentlyJeff Roberson2002-06-171-0/+1
| | | | | | | | | | | | | | | | | | | allocated slabs and bucket caches for free items. It will not go ask the vm for pages. This differs from M_NOWAIT in that it not only doesn't block, it doesn't even ask. - Add a new zcreate option ZONE_VM, that sets the BUCKETCACHE zflag. This tells uma that it should only allocate buckets out of the bucket cache, and not from the VM. It does this by using the M_NOVM option to zalloc when getting a new bucket. This is so that the VM doesn't recursively enter itself while trying to allocate buckets for vm_map_entry zones. If there are already allocated buckets when we get here we'll still use them but otherwise we'll skip it. - Use the ZONE_VM flag on vm map entries and pv entries on x86. Notes: svn path=/head/; revision=98361
* malloc/free(9) no longer require Giant. Use the malloc_mtx to protect theJeff Roberson2002-05-021-1/+6
| | | | | | | | | | mallochash. Mallochash is going to go away as soon as I introduce the kfree/kmalloc api and partially overhaul the malloc wrapper. This can't happen until all users of the malloc api that expect memory to be aligned on the size of the allocation are fixed. Notes: svn path=/head/; revision=95923
* Convert longs to u_longs in stats. This will hold off wrap arounds for aJeff Roberson2002-04-301-4/+4
| | | | | | | while longer. Notes: svn path=/head/; revision=95824
* Parenthesise macro arguments to reduce lint warnings.Mark Murray2002-04-211-1/+1
| | | | Notes: svn path=/head/; revision=95198
* Remove malloc_type's ks_limit.Jeff Roberson2002-04-151-4/+1
| | | | | | | | | | | | | | | Updated the kmemzones logic such that the ks_size bitmap can be used as an index into it to report the size of the zone used. Create the kern.malloc sysctl which replaces the kvm mechanism to report similar data. This will provide an easy place for statistics aggregation if malloc_type statistics become per cpu data. Add some code ifdef'd under MALLOC_PROFILING to facilitate a tool for sizing the malloc buckets. Notes: svn path=/head/; revision=94729
* Change ks_calls from int64_t to uint64_t, since it cannot be negative.Jeroen Ruigrok van der Werven2002-04-081-1/+1
| | | | | | | | | PR: 32342 Submitted by: ryan beasley <ryanb@goddamnbastard.org> Reviewed by: jeff, Tim J Robbins Notes: svn path=/head/; revision=94199
* Fixed some style bugs in the removal of __P(()). The main ones wereBruce Evans2002-03-231-9/+8
| | | | | | | | | not removing tabs before "__P((", and not outdenting continuation lines to preserve non-KNF lining up of code with parentheses. Switch to KNF formatting and/or rewrap the whole prototype in some cases. Notes: svn path=/head/; revision=93008
* Remove __PAlfred Perlstein2002-03-191-12/+12
| | | | Notes: svn path=/head/; revision=92719
* This is the first part of the new kernel memory allocator. This replacesJeff Roberson2002-03-191-68/+4
| | | | | | | | | malloc(9) and vm_zone with a slab like allocator. Reviewed by: arch@ Notes: svn path=/head/; revision=92654
* Add realloc() and reallocf(), and make free(NULL, ...) acceptable.Archie Cobbs2002-03-131-0/+4
| | | | | | | Reviewed by: alfred Notes: svn path=/head/; revision=92194
* - Remove asleep(), await(), and M_ASLEEP.John Baldwin2001-08-101-2/+1
| | | | | | | | | | | | - Callers of asleep() and await() have been converted to calling tsleep(). The only caller outside of M_ASLEEP was the ata driver, which called both asleep() and await() with spl-raised, so there was no need for the asleep() and await() pair. M_ASLEEP was unused. Reviewed by: jasone, peter Notes: svn path=/head/; revision=81397
* Let M_PANIC go back to the private tree as its intention isn't understood wellBoris Popov2001-01-311-1/+0
| | | | | | | for now. Notes: svn path=/head/; revision=71859
* Add M_PANIC flag to the list of available flags passed to malloc().Boris Popov2001-01-291-0/+1
| | | | | | | | | | With this flag set malloc() will panic if memory allocation failed. This usable only in critical places where failed allocation is fatal. Reviewed by: peter Notes: svn path=/head/; revision=71799
* Introduce the M_ZERO flag to malloc(9)Poul-Henning Kamp2000-10-201-0/+1
| | | | | | | | | | | | | | | | | Instead of: foo = malloc(sizeof(foo), M_WAIT); bzero(foo, sizeof(foo)); You can now (and please do) use: foo = malloc(sizeof(foo), M_WAIT | M_ZERO); In the future this will enable us to do idle-time pre-zeroing of malloc-space. Notes: svn path=/head/; revision=67384
* sys/malloc.h:Bruce Evans2000-06-141-1/+1
| | | | | | | | | | | | | | | Order the SYSINIT() for MALLOC_DEFINE() correctly so that malloc() doesn't have to waste time initializing itself. The (SI_SUB_KMEM, SI_ORDER_ANY) order was shared with syscons' SYSINIT() for scmeminit(), and scmeminit() calls malloc(), so malloc() initialization was not always complete on the first call to malloc(). kern/kern_malloc.c: - Removed self-initialization in malloc(). - Removed half-baked sanity check in free(). Trust MALLOC_DEFINE(). Notes: svn path=/head/; revision=61689
* Removed support for generating inline code for MALLOC() and FREE()Bruce Evans2000-06-141-45/+4
| | | | | | | | | | | | | | | | | | | | | | in the dysfunctional !KMEMSTATS case. This hasn't compiled since rev.1.31 of kern_malloc.c quietly removed the core of the support for the !KMEMSTATS case. I fixed it to see if it was worth saving and found that (as usual) inlining just wasted space and increased complexity without significantly affecting time, at least for the lmbench2 micro-benchmark on a Celeron. The space bloat was surprisingly large - the text size increased from 1700K to 1840K for a version with the entire malloc() family inlined. Removed even older garbage (kmemxtob() and btokmemx() macros). Attempt to deprecate MALLOC() and FREE(). Given current compilers (gcc-2.x or C99), they don't do anything that (safe) function-like macros or inline functions named malloc() and free() couldn't do. Fixed missing casts of macro args in MALLOC() and FREE(). Notes: svn path=/head/; revision=61680
* Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL"Peter Wemm1999-12-291-4/+4
| | | | | | | | | is an application space macro and the applications are supposed to be free to use it as they please (but cannot). This is consistant with the other BSD's who made this change quite some time ago. More commits to come. Notes: svn path=/head/; revision=55205
* KAME related header files additions and merges.Yoshinobu Inoue1999-11-051-0/+3
| | | | | | | | | | (only those which don't affect c source files so much) Reviewed by: cvs-committers Obtained from: KAME project Notes: svn path=/head/; revision=52904
* Force the "calls" count for malloc types to be 64 bit where it keeps trackPeter Wemm1999-10-011-2/+2
| | | | | | | | | | | | of the number of times a particular type has been used. It's rather easy to overflow. One site I'm looking at seems to do it in a matter of days. On the Alpha this is a no-op since 'long' is 64 bit already. The sole user of this interface seems to be vmstat -m and friends which will need a recompile. The overheads of using a 64 bit int should be pretty light as the kernel just does "calls++" type operations and that's it. Notes: svn path=/head/; revision=51842
* Fixed some style bugs (mainly disorderd prototypes).Bruce Evans1999-09-111-14/+9
| | | | Notes: svn path=/head/; revision=51168
* Get rid of MALLOC_INSTANTIATE and MALLOC_MAKE_TYPE(). Just handle the 3Bruce Evans1999-09-111-11/+3
| | | | | | | malloc types declared in <sys/malloc.h> like other global malloc types. Notes: svn path=/head/; revision=51167
* $Id$ -> $FreeBSD$Peter Wemm1999-08-281-1/+1
| | | | Notes: svn path=/head/; revision=50477
* Add a contigfree() as a corollary to contigmalloc() as it's not clearPeter Wemm1999-08-101-1/+4
| | | | | | | | which free routine to use and people are tempted to use free() (which doesn't work) Notes: svn path=/head/; revision=49615
* Fix warnings in preparation for adding -Wall -Wcast-qual to theMatthew Dillon1999-01-271-2/+2
| | | | | | | kernel compile Notes: svn path=/head/; revision=43301
* Renamed M_KERNEL to a more appropriate M_USE_RESERVE.Matthew Dillon1999-01-211-1/+1
| | | | Notes: svn path=/head/; revision=42962
* This is a rather large commit that encompasses the new swapper,Matthew Dillon1999-01-211-4/+6
| | | | | | | | | | | | | changes to the VM system to support the new swapper, VM bug fixes, several VM optimizations, and some additional revamping of the VM code. The specific bug fixes will be documented with additional forced commits. This commit is somewhat rough in regards to code cleanup issues. Reviewed by: "John S. Dyson" <root@dyson.iquest.net>, "David Greenman" <dg@root.com> Notes: svn path=/head/; revision=42957
* Have MALLOC_DECLARE() initialize malloc types explicitly, and have themPeter Wemm1998-11-101-4/+10
| | | | | | | | | | | removed at module unload (if in a module of course). However; this introduces a new dependency on <sys/kernel.h> for things that use MALLOC_DECLARE(). Bruce told me it is better to add sys/kernel.h to the handful of files that need it rather than add an extra include to sys/malloc.h for kernel compiles. Updates to follow in subsequent commits. Notes: svn path=/head/; revision=41054
* Reviewed by: dyson@freebsd.org (john Dyson), dg@root.com (david greenman)Julian Elischer1998-03-081-3/+5
| | | | | | | | Submitted by: Kirk McKusick (mcKusick@mckusick.com) Obtained from: WHistle development tree Notes: svn path=/head/; revision=34266
* Unspammed nested include of <vm/vm_zone.h>.Bruce Evans1997-12-271-3/+1
| | | | Notes: svn path=/head/; revision=32018
* Removed one `const' from the declaration of `ks_shortdesc'. The pointerBruce Evans1997-12-051-11/+12
| | | | | | | | | | | | isn't actually const in vmstat. Fixed pedantic syntax errors caused by trailing semicolons in macro definitions. Fixed style bugs and typos in revisions 1.26-1.33. Notes: svn path=/head/; revision=31559
* Moved declaration of M_IOV to a less bogus place. It belongs inBruce Evans1997-12-051-1/+8
| | | | | | | | <sys/uio.h>, but it doesn't work there because of header pollution (<sys/uio.h> is prematurely included by <sys/param.h>). Notes: svn path=/head/; revision=31558
* Some fixes from John Hood:John Dyson1997-12-051-2/+3
| | | | | | | | | | | 1) Fix the initialization of malloc structure that changed due to perf opt. 2) Remove unneeded include. 3) An initialization assert added to malloc. Submitted by: John Hood <cgull@smoke.marlboro.vt.us> Notes: svn path=/head/; revision=31549
* shuffle structs for better cacheline behavior.David Greenman1997-12-041-9/+9
| | | | Notes: svn path=/head/; revision=31526
* Remove the long description from the in-kernel datastructure.Poul-Henning Kamp1997-10-281-3/+5
| | | | | | | | Put a magic field in there instead, to help catch uninitialized malloc types. Notes: svn path=/head/; revision=30817
* Last major round (Unless Bruce thinks of somthing :-) of malloc changes.Poul-Henning Kamp1997-10-121-43/+7
| | | | | | | | | | | Distribute all but the most fundamental malloc types. This time I also remembered the trick to making things static: Put "static" in front of them. A couple of finer points by: bde Notes: svn path=/head/; revision=30354
* Distribute and statizice a lot of the malloc M_* types.Poul-Henning Kamp1997-10-111-44/+14
| | | | | | | Substantial input from: bde Notes: svn path=/head/; revision=30309
* Remove all traces of M_VFSCONF, which were for all practicalPoul-Henning Kamp1997-10-111-2/+1
| | | | | | | purposes unused. Notes: svn path=/head/; revision=30305
* Remove a bunch of unused malloc types.Poul-Henning Kamp1997-10-101-24/+10
| | | | | | | | A couple of potential bogons flagged. Various prototypes changed. Notes: svn path=/head/; revision=30282