summaryrefslogtreecommitdiff
path: root/sys/uvm/uvm_page.c
AgeCommit message (Collapse)Author
2013-05-30remove lots of comments about locking per beck's requestTed Unangst
2013-05-30remove simple_locks from uvm code. ok beck deraadtTed Unangst
2013-03-27combine several atomic_clearbits calls into one. slightly faster onTed Unangst
machines where atomic ops aren't so simple. ok beck deraadt miod
2013-03-12preserving main-branch topology for a perverse reason:Theo de Raadt
step 3 - re-merge 1.116 to 1.118
2013-03-12preserving main-branch topology for a perverse reason:Theo de Raadt
step 2 - re-merge 1.119 (the WAITOK diff)
2013-03-12preserving main-branch topology for a perverse reason:Theo de Raadt
step 1 - backout 1.116 to 1.119
2013-03-12Fix horrible typo of mine checking for WAITOK flags, found by sthen.Bob Beck
This fix actually by mikeb@, this needs thorough testing to verify it doesn't bring up other issues in what it hid. ok deraadt@
2013-03-06Account for the size of the allocation when defending the pagedaemon reserve.Bob Beck
Spotted by oga@nicotinebsd.org, with help from dhill@. Fix by me. ok miod@
2013-03-03Use local vm_physseg pointers instead of compting vm_physmem[index] gazillionsMiod Vallat
of times. No function change but makes the code a bit smaller. ok mpi@
2013-03-02Simplify uvm_pagealloc() to only need one atomic operation on the page flagsMiod Vallat
instead of two, building upon the knowledge of the state uvm_pagealloc_pg() leaves the uvm_page in. ok mpi@
2013-02-07Bring back reserve enforcement and page daemon wakeup into uvm_pglistalloc,Bob Beck
It was removed as this function was redone to use pmemrange in mid 2010 with the result that kernel malloc and other users of this function can consume the page daemon reserve and run us out of memory. ok kettenis@
2011-07-08some machines don't boot with the previous uvm reserve enforcement diff.Ted Unangst
back it out.
2011-07-07Move the uvm reserve enforcement from uvm_pagealloc to pmemrange.Owain Ainsworth
More and more things are allocating outside of uvm_pagealloc these days making it easy for something like the buffer cache to eat your last page with no repercussions (other than a hung machine, of course). ok ariane@ also ok ariane@ again after I spotted and fixed a possible underflow problem in the calculation.
2011-07-06uvm changes for buffer cache improvements.Bob Beck
1) Make the pagedaemon aware of the memory ranges and size of allocations where memory is being requested, and pass this information on to bufbackoff(), which will later (not yet) be used to ensure that the buffer cache gets out of the way in the right area of memory. Note that this commit does not yet make it *do* that - as currently the buffer cache is all in dma-able memory and it will simply back off. 2) Add uvm_pagerealloc_multi - to be used by the buffer cache code for reallocating pages to particular regions. much of this work by ariane, with smatterings of me, art,and oga ok oga@, thib@, ariane@, deraadt@
2011-07-03Rip out and burn support for UVM_HIST.Owain Ainsworth
The vm hackers don't use it, don't maintain it and have to look at it all the time. About time this 800 lines of code hit /dev/null. ``never liked it'' tedu@. ariane@ was very happy when i told her i wrote this diff.
2011-06-23Check for the correct flag when checking to see if the page is part of an aobj.Owain Ainsworth
This is no function change since aobjs never actually hit this path. (also it is my bug from a while ago). ok ariane@
2011-06-23Move uvm_pglistalloc and uvm_pglistfree to uvm_page.c and garbageOwain Ainsworth
college uvm_pglist.c uvm_pglistalloc and free are just thin wrappers around pmemrange these days and don't really need their own file. ok ariane@
2011-05-30Remove the freelist member from vm_physsegOwain Ainsworth
The new world order of pmemrange makes this data completely redundant (being dealt with by the pmemrange constraints instead). Remove all code that messes with the freelist. While touching every caller of uvm_page_physload() anyway, add the flags argument to all callers (all but one is 0 and that one already used PHYSLOAD_DEVICE) and remove the macro magic to allow callers to continue without it. Should shrink the code a bit, as well. matthew@ pointed out some mistakes i'd made. ``freelist death, I like. Ok.' ariane@ `I agree with the general direction, go ahead and i'll fix any fallout shortly'' miod@ (68k 88k and vax i could not check would build)
2011-05-10Kill vm_page_lookup_freelist.Owain Ainsworth
it belongs to a world order that isn't here anymore. More importantly it has been unused for a fair while now. ok thib@
2011-04-15Add a bit of paranoia to uvm_pageinsert.Owain Ainsworth
At various times diffs have had debugging that checked that we don't insert a page into the tree on top of an existing page, leaking that page's references. Until the recent hackathon (and introduction if uvm_pagealloc_multi) the bufcache for example did a rb tree look up on insert to check (under #ifdef DEBUG || 1) so instead just check it on pageinsert every time, since RB_INSERT returns any duplicates so this check is pretty much free. ``emphatically yes'' beck@
2011-04-03knf - trailing whitespace flense.Bob Beck
ok henning@
2011-04-02Constrain the buffer cache to use only the dma reachable region of memory.Bob Beck
With this change bufcachepercent will be the percentage of dma reachable memory that the buffer cache will attempt to use. ok deraadt@ thib@ oga@
2011-04-02Count the number of physical pages within a memory range.Ariane van der Steldt
Bob needs this. ok art@ bob@ thib@
2010-08-07No "\n" needed at the end of panic() strings.Kenneth R Westerback
Bogus chunks pointed out by matthew@ and miod@. No cookies for marco@ and jasper@. ok deraadt@ miod@ matthew@ jasper@ macro@
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-04-22Committing on behalf or ariane@.Owain Ainsworth
recommit pmemrange: physmem allocator: change the view of free memory from single free pages to free ranges. Classify memory based on region with associated use-counter (which is used to construct a priority list of where to allocate memory). Based on code from tedu@, help from many. Useable now that bugs have been found and fixed in most architecture's pmap.c ok by everyone who has done a pmap or uvm commit in the last year.
2010-04-20remove proc.h include from uvm_map.h. This has far reaching effects, asTed Unangst
sysctl.h was reliant on this particular include, and many drivers included sysctl.h unnecessarily. remove sysctl.h or add proc.h as needed. ok deraadt
2010-03-24Bring back PHYSLOAD_DEVICE for uvm_page_physload.Owain Ainsworth
ok kettenis@ beck@ (tentatively) and ariane@. deraadt asked for it to be commited now. original commit message: extend uvm_page_physload to have the ability to add "device" pages to the system. This is needed in the case where you need managed pages so you can handle faulting and pmap_page_protect() on said pages when you manage memory in such regions (i'm looking at you, graphics cards). these pages are flagged PG_DEV, and shall never be on the freelists, assert this. behaviour remains unchanged in the non-device case, specifically for all archs currently in the tree we panic if called after bootstrap. ok art@ kettenis@, beck@
2009-10-14Fix buffer cache backoff in the page daemon - deal with inactive pages toBob Beck
more correctly reflect the new state of the world - that is - how many pages can be cheaply reclaimed - which now includes clean buffer cache pages. This change fixes situations where people would be running with a large bufcachepercent, and still notice swapping without the buffer cache backing off. ok oga@, testing by many on tech@ and others. Thanks.
2009-08-13PAGEFASTRECYCLE is an option we have been using for a while to encourageTheo de Raadt
the kernel to reuse freed pages as quickly as possible, and it has been finding bugs (some of which we have already fixed) ok kettenis
2009-08-06reintroduce the uvm_tree commit.Owain Ainsworth
Now instead of the global object hashtable, we have a per object tree. Testing shows no performance difference and a slight code shrink. OTOH when locking is more fine grained this should be faster due to lock contention on uvm.hashlock. ok thib@, art@.
2009-07-26stop trying to fast-recycle pages for now. a few bugs have been found andTheo de Raadt
fixed, but now it is time for a little break from the chaos. ok kettenis
2009-07-23Insert free pages at the head of the page queues. Should provide betterMark Kettenis
cache locality and will pave the way for the new pmemrange allocator. Based on hints from art@ and ariane@. ok ariane@, deraadt@, oga@
2009-07-22Put the PG_RELEASED changes diff back in.Owain Ainsworth
This has has been tested very very thoroughly on all archs we have excepting 88k and 68k. Please see cvs log for the individual commit messages. ok beck@, thib@
2009-06-17date based reversion of uvm to the 4th May.Owain Ainsworth
More backouts in line with previous ones, this appears to bring us back to a stable condition. A machine forced to 64mb of ram cycled 10GB through swap with this diff and is still running as I type this. Other tests by ariane@ and thib@ also seem to show that it's alright. ok deraadt@, thib@, ariane@
2009-06-16Backout pmemrange (which to most people is more well known as physmemAriane van der Steldt
allocator). "i can't see any obvious problems" oga
2009-06-16Backout all changes to uvm after pmemrange (which will be backed outOwain Ainsworth
separately). a change at or just before the hackathon has either exposed or added a very very nasty memory corruption bug that is giving us hell right now. So in the interest of kernel stability these diffs are being backed out until such a time as that corruption bug has been found and squashed, then the ones that are proven good may slowly return. a quick hitlist of the main commits this backs out: mine: uvm_objwire the lock change in uvm_swap.c using trees for uvm objects instead of the hash removing the pgo_releasepg callback. art@'s: putting pmap_page_protect(VM_PROT_NONE) in uvm_pagedeactivate() since all callers called that just prior anyway. ok beck@, ariane@. prompted by deraadt@.
2009-06-14backout:Theo de Raadt
> extend uvm_page_physload to have the ability to add "device" pages to the > system. since it was overlayed over a system that we warned would go "in to be tested, but may be pulled out". oga, you just made me spend 20 minutes of time I should not have had to spend doing this.
2009-06-07extend uvm_page_physload to have the ability to add "device" pages to theOwain Ainsworth
system. This is needed in the case where you need managed pages so you can handle faulting and pmap_page_protect() on said pages when you manage memory in such regions (i'm looking at you, graphics cards). these pages are flagged PG_DEV, and shall never be on the freelists, assert this. behaviour remains unchanged in the non-device case, specifically for all archs currently in the tree we panic if called after bootstrap. ok art@, kettenis@, ariane@, beck@.
2009-06-06Since all callers of uvm_pagedeactivate did pmap_page_protect(.., VM_PROT_NONE)Artur Grabowski
just move that into uvm_pagedeactivate. oga@ ok
2009-06-03phys allocator fix: zeroed pages are not clean.Ariane van der Steldt
2009-06-02Instead of the global hash table with the terrible hashfunction and aOwain Ainsworth
global lock, switch the uvm object pages to being kept in a per-object RB_TREE. Right now this is approximately the same speed, but cleaner. When biglock usage is reduced this will improve concurrency due to lock contention.. ok beck@ art@. Thanks to jasper for the speed testing.
2009-06-02Clear PQ_ENCRYPT flag on uvm_pagefree, because free pages are by definitionAriane van der Steldt
not encrypted.
2009-06-01Since we've now cleared up a lot of the PG_RELEASED setting, remove theOwain Ainsworth
pgo_releasepg() hook and just free the page the "normal" way in the one place we'll ever see PG_RELEASED and should care (uvm_page_unbusy, called in aiodoned). ok art@, beck@, thib@
2009-06-01physmem allocator: change the view of free memory from single free pagesAriane van der Steldt
to free ranges. Classify memory based on region with associated use-counter (which is used to construct a priority list of where to allocate memory). Based on code from tedu@, help from many. Ok art@
2009-05-08Clear PQ_AOBJ at pageremove: when a page is no longer part of a uvm_object,Ariane van der Steldt
it is also not part of an aobj. Clear anon flags at pagefree: page is no longer part of an anon. ok oga
2009-05-08Remove static qualifier of functions that are not inline.Ariane van der Steldt
Makes trace in ddb useful. ok oga
2009-05-04Instead of keeping two ints in the uvm structure specifically just toOwain Ainsworth
sleep on them (and otherwise ignore them) sleep on the pointer to the {aiodoned,pagedaemon}_proc members, and nuke the two extra words. "no objections" art@, ok beck@.
2009-05-01uvm_page_alloc() + memset -> uvm_page_zalloc()Owain Ainsworth
nothing uses this code yet, but might as well do it the right way. "if you can't live without commiting this." miod@
2009-04-28Revert pageqlock back from a mutex to a simple_lock, as it needs to beMiod Vallat
recursive in some cases (mostly involving swapping). A proper fix is in the works, but this will unbreak kernels for now.