summaryrefslogtreecommitdiff
path: root/sys/uvm
AgeCommit message (Collapse)Author
2009-06-09correct loop in debug code to not use an uninitialised page. it wasOwain Ainsworth
ass-backwards. afaik this was found by the LLVM CLang static analyser. ok ariane@ a couple of days ago.
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-06Somehow I missed comitting this.Artur Grabowski
2009-06-06We need miod's no-coredumps-on-ramdisks diff, because we have grown theTheo de Raadt
media just a wee bit too much.
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-06Add uvm_objwire() and uvm_objunwire(), I need this for some of my crazyOwain Ainsworth
shitz. Code mostly from netbsd with some tweaks from me. The loaning case is specifcically if 0ed out right now because we do not do loaning. ok ariane@, art@.
2009-06-05Dynamic buffer cache sizing.Bob Beck
This commit won't change the default behaviour of the system unless the buffer cache size is increased with sysctl kern.bufcachepercent. By default our buffer cache is 10% of memory, which with this commit is now treated as a low water mark. If the buffer cache size is increased, the new size is treated as a high water mark and the buffer cache is permitted to grow to that percentage of memory. If the page daemon is invoked, the page daemon will ask the buffer cache to relenquish pages. if the buffer cache has more than the low water mark it will relenquish pages allowing them to be consumed by uvm. after a short period the buffer cache will attempt to re-grow back to the high water mark. This permits the use of a large buffer cache without penalizing the available memory for other purposes. Above the low water mark the buffer cache remains entirely subservient to the page daemon, so if uvm requires pages, the buffer cache will abandon them. ok art@ thib@ oga@
2009-06-04don't grab the lock just to read uvmexp.free.Owain Ainsworth
"that's retarded" art@.
2009-06-04remove redefinitions of static and __inline arianeJonathan Gray
says were debugging leftovers. ok ariane@
2009-06-03add a flexible buffer queue (bufq) api, based on the never usedThordur I. Bjornsson
one by tedu@. It doesn't do anything smart yet, it just uses plain old disksort. we also keep the old method of queueing bufs since some miods have crazy MD drivers that need some love. ok beck@, art@ tested by many on many archs.
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-01Deal with wraparound when checking RLIMIT_DATA.Todd C. Miller
OK guenther@ otto@
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-30in the (currently unused) loaning case for uvm_anfree, zero out anon->an_pageOwain Ainsworth
so we won't hit the kassert a little bit below it. "obviously better than what is there now" beck@
2009-05-23More PG_RELEASED cleaning.Owain Ainsworth
similar to the aobj.c changes, this one does vnodes. Vnodes are more complex because they actaully have to sync to backing store. So firstly, convert sync to sleep instead of setting released. Now, for backing store, in the PGO_FREE case, if we set PG_RELEASED *before* an async io, (nothing else will see it, the page is busy), then we can ignore the page after the io is done. We could do something similar for PGO_DEACTIVATE too, but that is another change. On error we just clear the released flag, nothing else sets it for uobj pages other than aiodoned. ok thib@, beck@, ariane@
2009-05-12Convert the udv_lock for the list of uvm_device objects over to a mutex.Owain Ainsworth
ok thib@, weingart@.
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-05Second step of PG_RELEASED cleanup.Owain Ainsworth
uvm_km deals with kernel memory which is either part of one of the kernel maps, or the main kernel object (a uao). If on km_pgremove we hit a busy page, just sleep on it, if so there's some async io (and that is unlikely). we can remove the check for uvm_km_alloc1() for a released page since now we will never end up with a removed but released page in the kernel map (due to the other chunk and the last diff). ok ariane@. Diff survived several make builds, on amd64 and sparc64, also forced paging with ariane's evil program.
2009-05-05The first step in cleaning up the use of PG_RELEASED for uvm objects.Owain Ainsworth
Now, the PG_ RELEASED flag currently has two (maybe three) uses. The valid one is for use with async io where we want to free the page after we've paged it out. The other ones are "oh i'd like to free this, but someone else is playing with it". It's simpler to just sleep on the damned page instead and stop the fiddling. First step does uao's: in uao_detach, sleep on the object and free it when we're clean, instead of setting a flag so it's freed after. In uao_flush, do the same. Change the interation over the object in flush so that we don't have to add marker pages or other such voodoo to the list when we sleep (netbsd did that when they had a similar diff), just use the hash always. We can now change uao_releasepg() to just free the page, and not bother with the KILLME stuff. When the other objects are fixed this hook will vanish. Much discussion with art@ over the idea, and ariane@ over this specific diff. As mentioned, this one is based loosely on a similar idea in netbsd. Been in my tree for a while, survived many make builds, etc, and forcing paging using ariane's evil program. ok ariane@, beck@.
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-02a few more memset changes.Owain Ainsworth
two cases of pool_get() + memset(0) -> pool_get(,,,PR_ZERO) 1.5 cases of global variables are already zeroed, so don't zero them. ok ariane@, comments on stuff i'd missed from blambert@ and cnst@.
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-30obvious typo in panic string.Owain Ainsworth
ariane@ ok.
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.
2009-04-20add the UVM_PLA_ZERO flag for uvm_pglistalloc to make it return zeroedOwain Ainsworth
pages. "go for it" miod@
2009-04-17Another case of locking just to read uvmexp.free. Kill the locking, notOwain Ainsworth
needed. "of course" art@.
2009-04-15We don't need to grab the fpageqlock to do nothing but look at the valueOwain Ainsworth
of uvmexp.free. "yeah, go for it" art@
2009-04-14Oops, this comment change should not have been commited. What itOwain Ainsworth
addresses is another diff.
2009-04-14The use of uvm.pagedaemon_lock is incredibly inconsistent. only aOwain Ainsworth
fraction of the wakeups and sleeps involved here actually grab that lock. The remainder, on the other hand, always have the fpageq_lock locked. So, make this locking correct by switching the other users over to fpageq_lock, too. This would probably be better off being a semaphore, but for now at least it's correct. "ok, unless you want to implement semaphores" art@
2009-04-14Convert the waitok field of uvm_pglistalloc to "flags", more will be added soon.Owain Ainsworth
For the possibility of sleeping, the first two flags are UVM_PLA_WAITOK and UVM_PLA_NOWAIT. It is an error not to show intention, so assert that one of the two is provided. Switch over every caller in the tree to using the appropriate flag. ok art@, ariane@
2009-04-13Convert the page queue lock to a mutex instead of a simplelock.Owain Ainsworth
Fix up the one case of lock recursion (which blatantly ignored the comment right above it saying that we don't need to lock). The rest of the lock usage has been checked and appears to be correct. ok ariane@.
2009-04-06In the case where VM_PHYSSEG_MAX == 1 make vm_physseg_find andOwain Ainsworth
PHYS_TO_VM_PAGE inline again. This should stop function call overhead killing the vax and other slow archs while keeping the benefit for the faster platforms. suggested by miod. ok miod@, toby@.
2009-04-06Instead of doing splbio(); simple_lock(&uvm.aiodoned_lock); just replaceOwain Ainsworth
the simple lock with a real lock - a IPL_BIO mutex. While i'm here, make the sleeping condition one hell of a lot simpler in the aio daemon. some ideas from and ok art@.
2009-04-05In the unlikely even that we do the final unref on a uvm_vnode objectOwain Ainsworth
while there's io pending (async io makes that possible, but not often hit), then we'll be waiting for the pgo_releasepg hook to free the object when all of our pages disappear. However, uvn_releasepg, while it does everything else that unreferencing the object would do, it neglects to do the final vrele() on the vnode. So in this rare situation we'd end up with the vnode waiting around until it was forcibly recycled. Fix this by adding in the missing vrele(). ok thib@
2009-03-27remove PGO_OVERWRITE, PGO_WEAK and PGO_PASTEOF from the pager. They're allOwain Ainsworth
unused. ok art@.
2009-03-26Convert splvm() + simplelock(&uvm.hashlock); around the page hash tableOwain Ainsworth
into a IPL_VM blocking mutex, also slightly extend the locked area so that it actually protects access to the page array (as the comment on the lock declaration says it should). ansify a few functions while i'm in the file. "ok, even though you're sneaking in ansification in a diff. You dirty you." art@
2009-03-25Move all of the pseudo-inline functions in uvm into C files.Owain Ainsworth
By pseudo-inline, I mean that if a certain macro was defined, they would be inlined. However, no architecture defines that, and none has for a very very long time. Therefore mainly this just makes the code a damned sight easier to read. Some k&r -> ansi declarations while I'm in there. "just commit it" art@. ok weingart@.
2009-03-24vm_physseg_find and VM_PAGE_TO_PHYS are both called many times in yourOwain Ainsworth
average arch port. They are also inline. This does not help, de-inline them. shaves about 1k on i386 and amd64 bsd.mp. Probably similar amounts of most architectures. "no issue" beck@ "Nuke nuke nuke... make them functions" weingart@ "this is good" art@
2009-03-23Whitespace nit in previous.Owain Ainsworth
2009-03-23turn a for (i = 0; i < size; i++) arc4random(); loop into arc4random_buf().Owain Ainsworth
Since that function is now so small (2 lines), inline it into it's only user. Shaves some bytes (104 on amd64). ok deraadt@, blambert@. djm@ liked an earlier diff.
2009-03-23Remove space added in last commit. Pointed out by miod@.Owain Ainsworth
2009-03-23Processor affinity for processes.Artur Grabowski
- Split up run queues so that every cpu has one. - Make setrunqueue choose the cpu where we want to make this process runnable (this should be refined and less brutal in the future). - When choosing the cpu where we want to run, make some kind of educated guess where it will be best to run (very naive right now). Other: - Set operations for sets of cpus. - load average calculations per cpu. - sched_is_idle() -> curcpu_is_idle() tested, debugged and prodded by many@
2009-03-20While working on some stuff in uvm I've gotten REALLY sick of readingOwain Ainsworth
K&R function declarations, so switch them all over to ansi-style, in accordance with the prophesy. "go for it" art@
2009-03-05Make ELF platforms generate ELF core dumps. Somewhat based on code fromMark Kettenis
NetBSD. ok kurt@, drahn@, miod@
2009-02-22On machines with less than 16MB of physical memory, reduce the lower boundMiod Vallat
of uvm_km_pages. ok deraadt@ tedu@
2009-02-11Remove uvm_km_alloc_poolpage1 as it serves no particular purposeMike Belopuhov
now and valid for __HAVE_PMAP_DIRECT archs only, though implements both code paths. Put it's code directly into the uvm_km_getpage for PMAP_DIRECT archs. No functional change. ok tedu, art