summaryrefslogtreecommitdiff
path: root/sys/uvm/uvm_page.c
AgeCommit message (Collapse)Author
2018-05-12Re-apply inadvertantly misplaced r1.127 from kettenis@:Kenneth R Westerback
"Buffer cache pages are wired but not counted as such. Therefore we have to set the wire count on the pages to 0 before we call uvm_pagefree() on them, just like we do in buf_free_pages(). Otherwise the wired pages counter goes negative. While there, also sprinkle some KASSERTs in there that buf_free_pages() has as well." ok beck@ (again)
2016-11-07Split PID from TID, giving processes a PID unrelated to the TID of theirPhilip Guenther
initial thread ok jsing@ kettenis@
2016-09-16move the vm_page struct from being stored in RB macro trees to RBT functionsDavid Gwynne
vm_page structs go into three trees, uvm_objtree, uvm_pmr_addr, and uvm_pmr_size. all these have been moved to RBT code. this should give us a decent chunk of code space back.
2015-10-30Fix two (verified to be harmless) off-by-ones in bounds checks inMiod Vallat
uvm_page_init() (causing uvmexp.npages to be sligthly wrong if pmap_steal_memory() has been used) and uvm_page_physload(). ok guenther@ kettenis@ visa@ beck@
2015-10-08Lock the page queues by turning uvm_lock_pageq() and uvm_unlock_pageq() intoMark Kettenis
mtx_enter() and mtx_leave() operations. Not 100% this won't blow up but there is only one way to find out, and we need this to make progress on further unlocking uvm. prodded by deraadt@
2015-09-21Drop a misleading XXX about PQ_AOBJ. Clear PQ_ANON unconditionally forVisa Hankala
consistency with PQ_AOBJ. Input kettenis@, ok beck@
2015-08-21Remove the unused loan_count field and the related uvm logic. Most ofVisa Hankala
the page loaning code is already in the Attic. ok kettenis@, beck@
2015-07-19Fix backward test that broke the cacheBob Beck
2015-07-19Change uvm_page[re]alloc_multi to actually use the flags passed in, and returnBob Beck
a value so that they may be called with UVM_PLA_NOWAIT ok kettenis@
2015-04-23tedu remnants of the previous attempt to implement page zeroing inDavid Gwynne
the idle thread. ok deraadt@
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-28Typo in comment 'reseve' -> 'reserve'Mike Larkin
2015-02-08Something is subtly wrong with this. On ramdisks, processes run out ofTheo de Raadt
mappable memory (direct or via execve), perhaps because of the address allocator behind maps and the way wiring counts work?
2015-02-07Tedu the old idle page zeroing code.Mark Kettenis
ok tedu@, guenther@, miod@
2015-02-06Clear PQ_AOBJ before calling uvm_pagefree(), clearing up one false XXXTheo de Raadt
comment (one is fixed, one is deleted). ok kettenis beck
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-07-11Chuck Cranor rescinded clauses in his licenseJonathan Gray
on the 2nd of February 2011 in NetBSD. http://marc.info/?l=netbsd-source-changes&m=129658899212732&w=2 http://marc.info/?l=netbsd-source-changes&m=129659095515558&w=2 http://marc.info/?l=netbsd-source-changes&m=129659157916514&w=2 http://marc.info/?l=netbsd-source-changes&m=129665962324372&w=2 http://marc.info/?l=netbsd-source-changes&m=129666033625342&w=2 http://marc.info/?l=netbsd-source-changes&m=129666052825545&w=2 http://marc.info/?l=netbsd-source-changes&m=129666922906480&w=2 http://marc.info/?l=netbsd-source-changes&m=129667725518082&w=2
2014-04-13compress code by turning four line comments into one line comments.Ted Unangst
emphatic ok usual suspects, grudging ok miod
2014-01-23unifdef -D__HAVE_VM_PAGE_MD - no functional change.Miod Vallat
2013-07-09back out the cache flipper temporarily to work out of tree.Bob Beck
will come back soon. ok deraadt@
2013-06-21Buffer cache pages are wired but not counted as such. Therefore we have toMark Kettenis
set the wire count on the pages to 0 before we call uvm_pagefree() on them, just like we do in buf_free_pages(). Otherwise the wired pages counter goes negative. While there, also sprinkle some KASSERTs in there that buf_free_pages() has as well. ok beck@
2013-06-11High memory page flipping for the buffer cache.Bob Beck
This change splits the buffer cache free lists into lists of dma reachable buffers and high memory buffers based on the ranges returned by pmemrange. Buffers move from dma to high memory as they age, but are flipped to dma reachable memory if IO is needed to/from and high mem buffer. The total amount of buffers allocated is now bufcachepercent of both the dma and the high memory region. This change allows the use of large buffer caches on amd64 using more than 4 GB of memory ok tedu@ krw@ - testing by many.
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@