summaryrefslogtreecommitdiff
path: root/sys/kern/kern_malloc.c
AgeCommit message (Collapse)Author
2021-05-16panic does not require a \n at the end. When one is provided, it looks wrong.Theo de Raadt
2021-04-21Convert remaining uvm_km_zalloc(9) to km_alloc(9).Martin Pieuchot
Tested by bluhm@, jj@, kettenis@ and Scott Bennett. ok kettenis@
2021-02-23remove unused malloc_roundup()Jonathan Gray
2020-12-31Add trace points for malloc(9) and free(9). This makes them traceableClaudio Jeker
via dt(4) and btrace(8). OK mpi@ millert@
2020-10-14delete strange historical FFS_SOFTUPDATES ifdef...Theo de Raadt
ok millert
2019-12-19Convert infinite sleeps to {m,t}sleep_nsec(9).Martin Pieuchot
ok visa@
2019-11-28Delete km_mapblocks from kmemstats and its always-zero column from the ddbPhilip Guenther
"show malloc" output ok deraadt@ mpi@
2019-05-15rework the zero warning slightly, and more completely disable until we'reTed Unangst
more ready to deal with the noise.
2019-05-09disable stack printing for now since at least arm64 can't print themTed Unangst
reported by kettenis
2019-05-08print a few warnings when calling free with a zero size.Ted Unangst
let's see what falls out. ok beck deraadt kettenis mpi
2018-07-10In free(9) call wakeup() after mtx_leave() consistently.Alexander Bluhm
OK kettenis@ visa@ mpi@
2018-07-09Fix trailing whitespaces and too long line.Alexander Bluhm
2018-07-09Make free(9) MP safe. It was wrong to set ku_indx to 0 after freeingAlexander Bluhm
the memory in uvm. Another process could use the false 0 then. To be on the safe side, protect all access to ku_indx and ku_pagecnt with a mutex. Update ku_indx and ku_pagecnt before calling uvm_km_free(). Update ksp after uvm_km_free() to keep accounting correct. tested by sthen@; OK mpi@ visa@ deraadt@
2018-01-18While booting it does not make sense to wait for memory, there isAlexander Bluhm
no other process which could free it. Better panic in malloc(9) or pool_get(9) instead of sleeping forever. tested by visa@ patrick@ Jan Klemkow suggested by kettenis@; OK deraadt@
2018-01-02Fix an off-by-one in the free(9) "passed size was too small" check:Philip Guenther
if the size passed is exactly half the size of the bucket that the allocation was actually from, then it was incorrect. problem noted by florian@ ok florian@ visa@
2017-11-14remove MALLOC_DEBUGDavid Gwynne
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@
2017-07-10make malloc(9) mpsafe by using a mutex instead of splvm.David Gwynne
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@
2017-06-07Assert that the calling CPU is holding the KERNEL_LOCK() in malloc(9)Martin Pieuchot
and free(9). The exception is at early boot when only one CPU is running since we grab the KERNL_LOCK() relatively late in main(). ok kettenis@
2015-03-14Remove some includes include-what-you-use claims don'tJonathan Gray
have any direct symbols used. Tested for indirect use by compiling amd64/i386/sparc64 kernels. ok tedu@ deraadt@
2015-02-13Include sys/stdint.h for SIZE_MAX instead of relying on the misplacedTodd C. Miller
define in sys/limits.h. OK guenther@
2014-12-10convert bcopy to memcpy. ok millertTed Unangst
2014-11-18move arc4random prototype to systm.h. more appropriate for most codeTed Unangst
to include that than rdnvar.h. ok deraadt dlg
2014-11-16Replace a plethora of historical protection options with justTheo de Raadt
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
2014-11-06need to calculate correct size before doing the free checks. the biggestTed Unangst
malloc bucket isn't precise, it can have anything in it. should fix recent panics. sorry for inconvenience. ok deraadt millert
2014-11-06let ramdisks compileTheo de Raadt
2014-11-05need to move lock up to prevent more than one malloc. ok guentherTed Unangst
2014-11-05don't use loop variable (i) for not loop things. use a new var.Ted Unangst
2014-11-05use memname to print string of type. stolen from deraadtTed Unangst
2014-11-05also print type when free size is wrongTed Unangst
2014-11-02tweak free panic messages tooTed Unangst
2014-11-02tweak panic messages for consistencyTed Unangst
2014-09-14remove uneeded proc.h includesJonathan Gray
ok mpi@ kspillner@
2014-07-13if the freedsize isn't zero, check that's reasonable. ok beckTed Unangst
2014-07-12add a size argument to free. will be used soon, but for now default to 0.Ted Unangst
after discussions with beck deraadt kettenis.
2014-07-10instead of defining two versions of bucketidx, just don't inline for small.Ted Unangst
ok deraadt
2014-07-10Add mallocarray(9)Matthew Dempsky
While here, change malloc(9)'s size argument from "unsigned long" to "size_t". ok tedu
2014-07-10pool_debug still needed for non-DIAGNOSTIC kernelsTheo de Raadt
2014-07-10hide the biglock thrashing under pool_debug so it can be turned offTed Unangst
2014-06-21you've had 12+ years to update your kernel config.Daniel Dickman
ok deraadt@
2014-05-19consistent use of uint32_t for poison valuesTed Unangst
2014-04-03if it's ok to wait, it must also be ok to give the kernel lock. do so.Ted Unangst
(then immediately reacquire it). this has the effect of giving interrupts on other CPUs to a chance to run and reduces latency in many cases. ok deraadt
2014-03-28Reduce uvm include madness. Use <uvm/uvm_extern.h> instead ofMartin Pieuchot
<uvm/uvm.h> if possible and remove double inclusions. ok beck@, mlarkin@, deraadt@
2014-01-21bzero -> memsetTed Unangst
2013-08-08Uncomment kprintf format attributes for sys/kernSylvestre Gallon
tested on vax (gcc3) ok miod@
2013-07-04permit free(NULL) to work. ok deraadtTed Unangst
2013-05-31open up some races. if pool_debug == 2, force a yield() whenever waitok.Ted Unangst
ok miod
2013-05-03switch the malloc and pool freelists to using xor simpleq.Ted Unangst
this adds a tiny bit more protection from list manipulation.
2013-04-06shuffle around some poison code, prototypes, values...Ted Unangst
allow some more pool debug code to be enabled if not compiled in bump poison size back up to 64
2013-03-28separate memory poisoning code to a new file and make it usable kernel wideTed Unangst
ok deraadt
2013-03-26replace kern malloc's hand rolled freelist with simpleq macros.Ted Unangst
ok deraadt mpi