summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_malloc_debug.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* remove MALLOC_DEBUGdlg2017-11-141-364/+0
| | | | | | | | the code has rotted, and obviously hasnt been used for ages. it is also hard to make mpsafe. if we need something like this again it would be better to do it from scratch. ok tedu@ visa@
* make malloc(9) mpsafe by using a mutex instead of splvm.dlg2017-07-101-28/+45
| | | | | | | | | | | | | this is almost a straightforward change of spl ops with mutex ops, except the accounting has been shuffled around. memory is counted as used before an attempt to allocate it from uvm is made to prevent overcommitting memory. this is modelled on how pools limit allocations. the uvm bits have been eyeballed by kettenis@ who says they should be safe. visa@ found some nits which have been fixed. tested by chris@ and amit kulkarni ok kettenis@ visa@ mpi@
* Replace a plethora of historical protection options with justderaadt2014-11-161-3/+3
| | | | | | | PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h. PROT_MASK is introduced as the one true way of extracting those bits. Remove UVM_ADV_* wrapper, using the standard names. ok doug guenther kettenis
* Reduce uvm include madness. Use <uvm/uvm_extern.h> instead ofmpi2014-03-281-2/+2
| | | | | | <uvm/uvm.h> if possible and remove double inclusions. ok beck@, mlarkin@, deraadt@
* Uncomment kprintf format attributes for sys/kernsyl2013-08-081-2/+2
| | | | tested on vax (gcc3) ok miod@
* allow kernel to compile with MALLOC_DEBUG.syl2013-06-251-2/+3
| | | | ok miod@
* Comment out recently added __attribute__((__format__(__kprintf__))) annotationsmiod2013-02-171-2/+2
| | | | | | in MI code; gcc 2.95 does not accept such annotation for function pointer declarations, only function prototypes. To be uncommented once gcc 2.95 bites the dust.
* Add explicit __attribute__ ((__format__(__kprintf__)))) to the functions andmiod2013-02-091-2/+3
| | | | | | function pointer arguments which are {used as,} wrappers around the kernel printf function. No functional change.
* Kill integer from pointer warning when compiling with MALLOC_DEBUG.mcbride2011-07-281-2/+2
| | | | ok kettenis
* Change format strings to allow 64 bit addresses to display properly,jsg2009-04-241-6/+7
| | | | | and add a missing argument to one of the printf calls. ok art@
* While splitting flags and pqflags might have been a good idea in theoryart2007-04-131-2/+2
| | | | | | | | | | | | to separate locking, on most modern machines this is not enough since operations on short types touch other short types that share the same word in memory. Merge pg_flags and pqflags again and now use atomic operations to change the flags. Also bump wire_count to an int and pg_version might go int as well, just for alignment. tested by many, many. ok miod@
* Instead of managing pages for intrsafe maps in special objects (aka.art2007-04-111-5/+3
| | | | | | | | kmem_object) just so that we can remove them, just use pmap_extract to get the pages to free and simplify a lot of code to not deal with the list of intrsafe maps, intrsafe objects, etc. miod@ ok
* Mechanically rename the "flags" and "version" fields in struct vm_pageart2007-04-041-2/+2
| | | | | | | | | | to "pg_flags" and "pg_version", so that they are a bit easier to work with. Whoever uses generic names like this for a popular struct obviously doesn't read much code. Most architectures compile and there are no functionality changes. deraadt@ ok ("if something fails to compile, we fix that by hand")
* Fix inversed logic in handling the "nowait/waitok" flags. Bugs in two placesart2004-06-201-3/+21
| | | | | | | | | | in malloc_debug. Also, add an assert-like function to sprinkle in code you're debugging at the moment. Those asserts are _not_ supposed to be ever comitted, just use them while debugging. beck@ ok
* license cleaning.art2003-06-031-5/+2
|
* Add a special malloc type M_DEBUG.art2002-12-201-4/+5
| | | | | If the kernel is compiled with MALLOC_DEBUG, M_DEBUG will force the allocation to be done through malloc_debug.
* Hmm.. I don't think we want the default to be to debug every allocation.art2002-12-051-3/+3
|
* Do not use debug_malloc if it hasn't been initialized.art2002-12-051-4/+9
| | | | | | | | | This can happen when debug_malloc_init calls pool_init which calls malloc (because the kernel is built with POOL_DIAGNOSTIC) which in turn calls debug_malloc and debug_malloc just happens to trigger on all memory allocations. This allows us to run a kernel debugging _all_ allocations.
* Don't abuse VM_PROT_ALL. Use VM_PROT_READ|VM_PROT_WRITE here.art2002-07-011-2/+2
| | | | We'll never want to exec code in malloc mappings.
* splassert where neededart2002-06-111-1/+3
|
* Pool deals fairly well with physical memory shortage, but it doesn't dealart2002-01-231-2/+2
| | | | | | | | | | | | | | | | | | well (not at all) with shortages of the vm_map where the pages are mapped (usually kmem_map). Try to deal with it: - group all information the backend allocator for a pool in a separate struct. The pool will only have a pointer to that struct. - change the pool_init API to reflect that. - link all pools allocating from the same allocator on a linked list. - Since an allocator is responsible to wait for physical memory it will only fail (waitok) when it runs out of its backing vm_map, carefully drain pools using the same allocator so that va space is freed. (see comments in code for caveats and details). - change pool_reclaim to return if it actually succeeded to free some memory, use that information to make draining easier and more efficient. - get rid of PR_URGENT, noone uses it.
* Sprinkle pmap_update calls where relevant and some otherart2001-12-081-1/+3
| | | | misc pmap usage fixes.
* Replace inclusion of <vm/foo.h> with the correct <uvm/bar.h> when necessary.miod2001-11-061-2/+1
| | | | (Look ma, I might have broken the tree)
* merge vm/vm_kern.h into uvm/uvm_extern.h; art@ okmickey2001-09-191-2/+1
|
* typo in the comment.mpech2001-08-301-2/+2
|
* When this code was imported to NetBSD by Jason Thorpe he did a bunch ofart2001-08-171-108/+88
| | | | useful changes (and a lot of cleanup). Bring in them.
* Be more careful with ranges.art2001-07-261-3/+10
| | | | From Heikki Korpela <heko@iki.fi>
* Typo.art2001-07-181-2/+2
| | | | Noted by: Heikki Korpela <heko@iki.fi>
* Get rid of the PMAP_NEW option by making it mandatory for all archs.art2001-07-181-10/+1
| | | | | The archs that didn't have a proper PMAP_NEW now have a dummy implementation with wrappers around the old functions.
* Since normal malloc reports "data modified on free list" withart2001-07-171-1/+4
| | | | | | the size we are trying to allocate and not the size of the bucket and malloc_debug is not capable of debugging a prticular bucket, only a size, add a possibility to specify a size range.
* remove old vmart2001-06-271-5/+1
|
* Allow passing an address to 'show malloc' and print out some information aboutart2000-06-071-6/+32
| | | | that address.
* Change debug_malloc_print so that it can be called from ddb.art2000-06-071-10/+18
|
* Default type and size to -1.art2000-06-071-3/+3
|
* This code will not work without UVM.art2000-06-061-1/+5
| | | | Add an #error instead of breaking while compiling.
* malloc debugging code. Enabled by option MALLOC_DEBUG.art2000-06-061-0/+308
Make sure you read the docs (malloc(9)) before use.