summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_pool.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* use pool_count to report the number of pools to userland ratherdlg2014-07-021-34/+18
| | | | | | | than walking the list and counting the elements as we go. use sysctl_rdint, sysctl_rdstring, and sysctl_rdstruct instead of handcrafted copyouts.
* provide a pool_count global so we can figure out how many pools there aredlg2014-07-021-1/+4
| | | | active without having to walk the global pool_list.
* take the pools mutex when copying stats out of it in the sysctldlg2014-07-021-1/+5
| | | | path so we are guaranteed a consistent snapshot.
* add an explicit rwlock around the global state (the pool list and serialdlg2014-07-021-35/+49
| | | | | | | | | number) rather than rely on implicit process exclusion, splhigh and splvm. the only things touching the global state come from process context so we can get away with an rwlock instead of a mutex. thankfully. ok matthew@
* info about pools is currently given to userland by copying eachdlg2014-07-021-10/+25
| | | | | | | | | | | | | | | | | | | | | | | pools struct out. however, struct pool in the kernel contains lots of things that userland probably isnt interested in, like actual mutexes, and probably shouldnt get easy access to, like pointers to kernel memory via all the lists/trees. this implements a kinfo_pool structure that has only the data that userland needs to know about. it cuts the sysctl code over to building it from struct pool as required and copying that out instead, and cuts userland over to only handling kinfo_pool. the only problem with this is vmstat, which can read kernel images via kvm, which needs some understanding of struct pool. to cope, the struct pool definition is guarded by if defined(_KERNEL) || defined(_LIBKVM) as inspired by sysctl which needs to do the same thing sometimes. struct pool itself is generally not visible to userland though, which is good. matthew@ suggested struct kinfo_pool instead of struct pool_info. the kinfo prefix has precedent. lots of people liked this.
* consistent use of uint32_t for poison valuestedu2014-05-191-3/+3
|
* with some random chance, swizzle the current page for the pool to avoidtedu2014-05-011-6/+25
| | | | fully deterministic behavior. ok deraadt
* if it's ok to wait, it must also be ok to give the kernel lock. do so.tedu2014-04-031-3/+7
| | | | | | (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
* 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@
* remove pool constructors and destructors. theyre called for everydlg2013-11-051-30/+4
| | | | | | | | | get and put, so they dont save us anything by caching constructed objects. there were no real users of them, and this api was never documented. removing conditionals in a hot path cant be a bad idea either. ok deraadt@ krw@ kettenis@
* Uncomment kprintf format attributes for sys/kernsyl2013-08-081-8/+9
| | | | tested on vax (gcc3) ok miod@
* blow up sooner rather than later for double pool_puttedu2013-06-051-1/+7
| | | | ok deraadt
* open up some races. if pool_debug == 2, force a yield() whenever waitok.tedu2013-05-311-2/+5
| | | | ok miod
* switch the malloc and pool freelists to using xor simpleq.tedu2013-05-031-13/+13
| | | | this adds a tiny bit more protection from list manipulation.
* check that the pool we are about to init isn't already on the list intedu2013-04-171-13/+25
| | | | | order to detect double init mistakes. add a similar check and rearrange pool_destory to detect the opposite mistake.
* make kernel compilederaadt2013-04-061-1/+3
|
* shuffle around some poison code, prototypes, values...tedu2013-04-061-24/+7
| | | | | allow some more pool debug code to be enabled if not compiled in bump poison size back up to 64
* replace pool debug magic with shared mem poison codetedu2013-03-311-36/+22
| | | | ok deraadt
* simpleq is lighter weight and sufficient for pool's needs.tedu2013-03-261-19/+32
| | | | ok deraadt
* Comment out recently added __attribute__((__format__(__kprintf__))) annotationsmiod2013-02-171-8/+8
| | | | | | 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-13/+18
| | | | | | function pointer arguments which are {used as,} wrappers around the kernel printf function. No functional change.
* Fix compilation with POOL_DEBUG but !DDBguenther2012-12-241-2/+7
| | | | ok jsing@ krw@ mikeb@
* block interrupts while pool_reclaim_all is grubbing around in every poolsdlg2011-11-231-1/+5
| | | | | | | | 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@
* touching pr_nput and pr_nget outside the lock might be racy since ++ and --dlg2011-09-231-4/+5
| | | | | | arent necessarily atomic. this is an update of a diff matthew@ posted to tech@ over a year ago.
* ph = pool_get(&phpool, PR_NOWAIT) can return NULL, so dont unconditionallydlg2011-09-231-2/+2
| | | | | | write to ph. ok blambert@ matthew@ deraadt@
* remove the predict_whatever stuffs. ok deraadt dlg henningtedu2011-07-061-16/+16
|
* move a few accounting adjustments closer to removing the page, just to be safe.tedu2011-07-061-6/+6
| | | | | also, rmpage updates curpage, no need to do it twice. ok art deraadt guenther
* Remove a broken optimization found by the new pool_chk code. Ittedu2011-07-051-4/+1
| | | | | | leaves an empty page in curpage, and this inconsistency slowly spreads until finally one of the other pool checks freaks out. ok art deraadt
* when all you have is a hammer, make it a big one. add more checks to pool_chktedu2011-07-051-14/+50
| | | | and a pool_init flag to aggressively run pool_chk. ok art deraadt
* Put back the change of pool and malloc into the new km_alloc(9) api.art2011-04-181-31/+25
| | | | | | The problems during the hackathon were not caused by this (most likely). prodded by deraadt@ and beck@
* Backout the uvm_km_getpage -> km_alloc conversion. Weird things are happeningart2011-04-061-25/+31
| | | | | | and we aren't sure what's causing them. shouted oks by many before I even built a kernel with the diff.
* - Change pool constraints to use kmem_pa_mode instead of uvm_constraint_rangeart2011-04-051-31/+25
| | | | | | | | - 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
* sysctl kern.pool_debug=0 will disable POOL_DEBUG on the fly (still defaultsderaadt2011-04-041-24/+40
| | | | | | | | | 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
* Helper functions for suspend.ariane2011-04-031-1/+13
| | | | | | | | | | | Allow reclaiming pages from all pools. Allow zeroing all pages. Allocate the more equal pig. mlarking@ needs this. Not called yet. ok mlarkin@, theo@
* pool_sethardlimit should not imply pool_sethiwat; figured out with claudiomikeb2010-11-031-8/+1
| | | | ok claudio tedu
* unify some pool and malloc flag values. the important bit is that all flagstedu2010-09-261-1/+3
| | | | | have real values, no 0 values anymore. ok deraadt kettenis krw matthew oga thib
* Add assertwaitok(9) to declare code paths that assume they can sleep.matthew2010-09-211-2/+2
| | | | | | | | | | 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.
* explicitly specify flags to malloc and pool_get instead of relying on 0.tedu2010-07-031-2/+3
| | | | | This is more clear, and as thib pointed out, the default in softraid was wrong. ok thib.
* add an align argument to uvm_km_kmemalloc_pla.art2010-07-021-4/+4
| | | | | | | | | 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
* Add a no_constraint uvm_constraint_range; use it in the pool code.thib2010-06-291-8/+2
| | | | ok tedu@, beck@, oga@
* uvm constraints. Add two mandatory MD symbols, uvm_md_constraintsthib2010-06-271-7/+36
| | | | | | | | | | | | | | | | | | | | | | 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
* aligment -> alignmentmiod2010-06-171-2/+2
|
* When allocating from the item header pool, we can't sleep, as we may be holding a mutex which won't be released. From Christian Ehrhardt.tedu2010-01-161-4/+3
| | | | While here, fix another buglet: no need to pass down PR_ZERO either, as noticed by blambert@.
* sync comment to reality, off-page page headers go intothib2009-09-051-3/+3
| | | | an RB tree, not into a hashtable.
* add commented out options for PAGEFASTRECYCLE, KVA_GUARDPAGES, shuffle VFSDEBUGthib2009-08-261-2/+1
| | | | | | around and add POOL_DEBUG as an enabled option, removing the define from subr_pool.c. comments & ok deraadt@.
* add a show all vnodes command, use dlg's nice pool_walk() to accomplishthib2009-08-131-4/+5
| | | | | | this. ok beck@, dlg@
* Use an RB tree instead of a SPLAY tree for the page headers tree.thib2009-08-091-8/+8
| | | | ok beck@, dlg@
* We enable POOL_DEBUG (except in a release)deraadt2009-07-301-2/+2
|
* turn off POOL_DEBUG as we go into release; pointed out by mpfderaadt2009-06-241-2/+2
|
* rework pool_get() a bit so that if you call if with a constructor setoga2009-06-121-9/+16
| | | | | | | | | | | | | *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.