summaryrefslogtreecommitdiff
path: root/sys/kern/subr_pool.c
AgeCommit message (Collapse)Author
2011-11-23block interrupts while pool_reclaim_all is grubbing around in every poolsDavid Gwynne
internals. this fixes a panic i got where a network interrupt tried to use the mbuf pools mutex while pool_reclaim_all already held it which lead to the same cpu trying to lock that mutex twice. ok deraadt@
2011-09-23touching pr_nput and pr_nget outside the lock might be racy since ++ and --David Gwynne
arent necessarily atomic. this is an update of a diff matthew@ posted to tech@ over a year ago.
2011-09-23ph = pool_get(&phpool, PR_NOWAIT) can return NULL, so dont unconditionallyDavid Gwynne
write to ph. ok blambert@ matthew@ deraadt@
2011-07-06remove the predict_whatever stuffs. ok deraadt dlg henningTed Unangst
2011-07-06move a few accounting adjustments closer to removing the page, just to be safe.Ted Unangst
also, rmpage updates curpage, no need to do it twice. ok art deraadt guenther
2011-07-05Remove a broken optimization found by the new pool_chk code. ItTed Unangst
leaves an empty page in curpage, and this inconsistency slowly spreads until finally one of the other pool checks freaks out. ok art deraadt
2011-07-05when all you have is a hammer, make it a big one. add more checks to pool_chkTed Unangst
and a pool_init flag to aggressively run pool_chk. ok art deraadt
2011-04-18Put back the change of pool and malloc into the new km_alloc(9) api.Artur Grabowski
The problems during the hackathon were not caused by this (most likely). prodded by deraadt@ and beck@
2011-04-06Backout the uvm_km_getpage -> km_alloc conversion. Weird things are happeningArtur Grabowski
and we aren't sure what's causing them. shouted oks by many before I even built a kernel with the diff.
2011-04-05 - Change pool constraints to use kmem_pa_mode instead of uvm_constraint_rangeArtur Grabowski
- Use km_alloc for all backend allocations in pools. - Use km_alloc for the emergmency kentry allocations in uvm_mapent_alloc - Garbage collect uvm_km_getpage, uvm_km_getpage_pla and uvm_km_putpage ariane@ ok
2011-04-04sysctl kern.pool_debug=0 will disable POOL_DEBUG on the fly (still defaultsTheo de Raadt
to on, if POOL_DEBUG is compiled in, so that boot-time pool corruption can be found. When the sysctl is turned off, performance is almost as as good as compiling with POOL_DEBUG compiled out. Not all pool page headers can be purged of the magic checks. performance tests by henning ok ariane kettenis mikeb
2011-04-03Helper functions for suspend.Ariane van der Steldt
Allow reclaiming pages from all pools. Allow zeroing all pages. Allocate the more equal pig. mlarking@ needs this. Not called yet. ok mlarkin@, theo@
2010-11-03pool_sethardlimit should not imply pool_sethiwat; figured out with claudioMike Belopuhov
ok claudio tedu
2010-09-26unify some pool and malloc flag values. the important bit is that all flagsTed Unangst
have real values, no 0 values anymore. ok deraadt kettenis krw matthew oga thib
2010-09-21Add assertwaitok(9) to declare code paths that assume they can sleep.Matthew Dempsky
Currently only checks that we're not in an interrupt context, but will soon check that we're not holding any mutexes either. Update malloc(9) and pool(9) to use assertwaitok(9) as appropriate. "i like it" art@, oga@, marco@; "i see no harm" deraadt@; too trivial for me to bother prying actual oks from people.
2010-07-03explicitly specify flags to malloc and pool_get instead of relying on 0.Ted Unangst
This is more clear, and as thib pointed out, the default in softraid was wrong. ok thib.
2010-07-02add an align argument to uvm_km_kmemalloc_pla.Artur Grabowski
Use uvm_km_kmemalloc_pla with the dma constraint to allocate kernel stacks. Yes, that means DMA is possible to kernel stacks, but only until we've fixed all the scary drivers. deraadt@ ok
2010-06-29Add a no_constraint uvm_constraint_range; use it in the pool code.Thordur I. Bjornsson
ok tedu@, beck@, oga@
2010-06-27uvm constraints. Add two mandatory MD symbols, uvm_md_constraintsThordur I. Bjornsson
which contains the constraints for DMA/memory allocation for each architecture, and dma_constraints which contains the range of addresses that are dma accessable by the system. This is based on ariane@'s physcontig diff, with lots of bugfixes and additions the following additions by my self: Introduce a new function pool_set_constraints() which sets the address range for which we allocate pages for the pool from, this is now used for the mbuf/mbuf cluster pools to keep them dma accessible. The !direct archs no longer stuff pages into the kernel object in uvm_km_getpage_pla but rather do a pmap_extract() in uvm_km_putpages. Tested heavily by my self on i386, amd64 and sparc64. Some tests on alpha and SGI. "commit it" beck, art, oga, deraadt "i like the diff" deraadt
2010-06-17aligment -> alignmentMiod Vallat
2010-01-16When allocating from the item header pool, we can't sleep, as we may be ↵Ted Unangst
holding a mutex which won't be released. From Christian Ehrhardt. While here, fix another buglet: no need to pass down PR_ZERO either, as noticed by blambert@.
2009-09-05sync comment to reality, off-page page headers go intoThordur I. Bjornsson
an RB tree, not into a hashtable.
2009-08-26add commented out options for PAGEFASTRECYCLE, KVA_GUARDPAGES, shuffle VFSDEBUGThordur I. Bjornsson
around and add POOL_DEBUG as an enabled option, removing the define from subr_pool.c. comments & ok deraadt@.
2009-08-13add a show all vnodes command, use dlg's nice pool_walk() to accomplishThordur I. Bjornsson
this. ok beck@, dlg@
2009-08-09Use an RB tree instead of a SPLAY tree for the page headers tree.Thordur I. Bjornsson
ok beck@, dlg@
2009-07-30We enable POOL_DEBUG (except in a release)Theo de Raadt
2009-06-24turn off POOL_DEBUG as we go into release; pointed out by mpfTheo de Raadt
2009-06-12rework pool_get() a bit so that if you call if with a constructor setOwain Ainsworth
*and* PR_ZERO in flags, you will no longer zero our your nicely constructed object. Instead, now if you have a contructor set, and you set PR_ZERO, you will panic (it's invalid due to how constructor work). ok miod@ deraadt@ on earlier versions of the diff. ok tedu@ after he pointed out a couple of places I messed up. Problem initally noticed by ariane@ a while ago.
2009-06-04POOL_DEBUG and DIAGNOSTIC should be better friendsTheo de Raadt
2009-06-04the POOL_DEBUG checks needed to be more friendly with DIAGNOSTICTheo de Raadt
2009-06-04enable POOL_DEBUG again just for the hackathon.Owain Ainsworth
slackers now get more bugs to fix, yay! discussed with deraadt@.
2009-05-31Move splassert checks from pool_do_get to pool_get(). Since the formerMiod Vallat
is invoked with the pool mutex held, the asserts are satisfied by design. ok tedu@
2009-04-22initialise the constructor and destructor function pointers to NULLDavid Gwynne
in pool_init so you the pool struct doesn't have to be zeroed before you init it.
2009-02-17ensure all pi_magic checks are inside DIAGNOSTICTheo de Raadt
2009-02-16at tedu's request, bring back the basic single "first word" PI_MAGIC checkTheo de Raadt
since it is essentially free. To turn on the checking of the rest of the allocation, use 'option POOL_DEBUG' ok tedu
2009-02-16Disable pool debug stuff for the release (it has a performance hit, butTheo de Raadt
between releases we may want to turn it on, since it has uncovered real bugs) ok miod henning etc etc
2008-12-23i got emptypages and fullpages mixed up in pool_walk. this now shows itemsDavid Gwynne
in fullpages that have been allocated. spotted by claudio@
2008-12-23add pool_walk as debug code.David Gwynne
this can be used to walk over all the items allocated with a pool and have them examined by a function the caller provides. with help from and ok tedu@
2008-12-23record the offset into each pool page that item allocations actually beginDavid Gwynne
on, aka, its coloring. ok tedu@
2008-12-04Put back the support for pools > PAGE_SIZE. This time the compare functionArtur Grabowski
works and there's even some sanity checks that it actually returns what we expect it to return.
2008-11-25Back out the large page pools for now. The compare function isArtur Grabowski
borked and instead of stressing to figure out how to fix it, I'll let peoples kernels to work.
2008-11-25Make sure that equal elements always compare equal. Logic error spottedArtur Grabowski
by otto@ ok otto@
2008-11-24Protect kmem_map allocations with splvm.Artur Grabowski
This should make dlg happy.
2008-11-24Allow allocations larger than PAGE_SIZE from pools.Artur Grabowski
This is solved by special allocators and an obfuscated compare function for the page header splay tree and some other minor adjustments. At this moment, the allocator will be picked automagically by pool_init and you can get a kernel_map allocator if you specify PR_WAITOK in flags (XXX), default is kmem_map. This will be changed in the future once the allocator code is slightly reworked. But people want to use it now. "nag nag nag nag" dlg@
2008-11-22Do deadbeef-style protection in pools too, by default, even though it itTheo de Raadt
is a lot slower. Before release this should be backed out, but for now we need everyone to run with this and start finding the use-after-free style bugs this exposes. original version from tedu ok everyone in the room
2008-10-31accidental commit ... backoutTheo de Raadt
2008-10-31kern_sysctl.cTheo de Raadt
2008-10-24yet again i prove unable to commit what i really wanted. spotted by deraadtTed Unangst
2008-10-23a better fix for the "uvm_km thread runs out of memory" problem.Ted Unangst
add a new arg to the backend so it can tell pool to slow down. when we get this flag, yield *after* putting the page in the pool's free list. whatever we do, don't let the thread sleep. this makes things better by still letting the thread run when a huge pf request comes in, but without artificially increasing pressure on the backend by eating pages without feeding them forward. ok deraadt
2008-06-26First pass at removing clauses 3 and 4 from NetBSD licenses.Ray Lai
Not sure what's more surprising: how long it took for NetBSD to catch up to the rest of the BSDs (including UCB), or the amount of code that NetBSD has claimed for itself without attributing to the actual authors. OK deraadt@