summaryrefslogtreecommitdiff
path: root/sys/uvm
AgeCommit message (Collapse)Author
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
2009-02-05Add some (currently unused) MD pmap flags to be used for pushing inOwain Ainsworth
parameters such as cacheability, which is too different per-arch to be MI. discussed with miod, kettenis and art. ok miod@, art@.
2009-01-27Get rid of the last traces of uvm.pager_[se]vaMiod Vallat
2009-01-27Simplify page-out/page-in map management; fix rare pager deadlock.Ariane van der Steldt
Ok: miod, tedu
2009-01-25Remove /dev/drum and related code.Miod Vallat
2009-01-20Variables were never used, never implemented.Ariane van der Steldt
Ok miod, toby
2009-01-12Register aiodoned_proc, although it is not used anywhere yet; PR #6034Miod Vallat
2008-11-24garbage collect uvm_errno2vmerror();Thordur I. Bjornsson
ok miod@, art@
2008-11-24init uvm_km_page memory a bit earlier to reduce pressure on pmap bootstrapKurt Miller
pages. "looks good/no problems with it" tedu@ miod@ art@
2008-11-10typo: be -> by in commentOwain Ainsworth
``of course'' deraadt@.
2008-11-10vm_map_lock() around calls to uvm_map_findspace(); ok teduTheo de Raadt
2008-11-04uvmspace_unshare() is never used; ok miodTheo de Raadt
2008-10-24it is a good policy to clear the pointer after we free somethingTheo de Raadt
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-10-18Revert the change to use pools for <= PAGE_SIZE allocations. ItMark Kettenis
changes the pressure on the uvm system, uncovering several bugs. Some of those bugs result in provable deadlocks. We'll have to reconsider integrating this diff again after fixing those bugs. ok art@
2008-10-08Don't extend amaps beyond what their supposed maximum. This code path isArtur Grabowski
not taken anymore, but it doesn't hurt to be correct. from NetBSD, through mickey in pr 5812 prodded by otto@
2008-10-06uvn_attach message is purely diagnostic, not neededTheo de Raadt
no ok's from anyone because they are all slacking
2008-10-01In uvm_pglistalloc(), do not fall through the success code if we could not findMiod Vallat
a suitable range and ran out of memory segments. Oops.
2008-09-29Use pools to do allocations for all sizes <= PAGE_SIZE.Artur Grabowski
This will allow us to escape the limitations of kmem_map. At this moment, the per-type limits are still enforced for all sizes, but we might loosen that limit in the future after some thinking. Original diff from Mickey in kernel/5761 , I massaged it a little to obey the per-type limits. miod@ ok
2008-09-23Do not merge userland map entries.Artur Grabowski
Imagine lots of random small mappings (think malloc(3)) and sometimes one large mapping (network buffer). If we've filled up our address space enough, the random address picked for the large allocation is likely to be overlapping an existing small allocation, so we'll do a linear scan to find the next free address. That next free address is likely to be just after a small allocation. Those two map entires get merged. If we now allocate an amap for the merged map entry, it will be large. When we later free the large allocation the amap is not truncated. All these are design decisions that made sense for sbrk, but with random allocations and malloc that actually returns memory, this really hurt us. This is the reason why certain processes like apache and sendmail could eat more than 10 times as much amap memory as they needed, eventually hitting the malloc limit and hanging or running the machine out of kmem_map and crashing. otto@ ok
2008-09-16remove dead stores and newly created unused variables.Charles Longeau
Found by LLVM/Clang Static Analyzer. ok miod@ art@
2008-09-13fix potential use of uninitialized valueCharles Longeau
Found by LLVM/Clang Static Analyzer. "Right." miod@
2008-09-12less waste for amaps in the common case:Otto Moerbeek
allocate a single malloc chunk instead of three and allocate a single slot for a single page instead of four slots. ok miod@ tedu@ @deraadt
2008-08-26Plug potential memory leak.Mark Kettenis
"looks sane to me" otto@, ok miod@
2008-07-25Correct printing of the pg_flags for ddb.Artur Grabowski
2008-07-25some splassert paranoia.Artur Grabowski
2008-07-18Add new uvm function called uvm_map_pie() which takes align as aKurt Miller
parameter and returns an aligned random load address for position independent executables to use. This also adds three new vmparam.h defines to specify the maximum address, minimum address and minimum allowed alignment for uvm_map_pie() to use. The PIE address range for i386 was carefully selected to work well within the i386 W^X framework. With much help and feedback from weingart@. okay weingart@, miod@, kettenis@, drahn@
2008-07-02Make the pagedaemon a bit happier.Artur Grabowski
1. When checking if the pagedaemon should be awakened and to see how much work it should do, consider the buffer cache deficit (how much pages the buffer cache can eat max vs. how much it has now) as pages that are not free. They are actually still usable by the allocator, but the presure on the pagedaemon is increased when we starting to chew into the memory that the buffer cache wants to use. 2. Remove the stupid 512kB limit of how much memory should be our free target. That maybe made sense on 68k, but on modern systems 512k is just a joke. Keep it at 3% of physical memory just like it was meant to be. 3. When doing allocations for the pagedaemon, always let it use the reserve. the whole UVM_OBJ_IS_KERN_OBJECT is silly and doesn't work in most cases anyway. We still don't have a reserve for the pagedaemon in the km_page allocator, but this seems to help enough. (yes, there are still bad cases in that code and the comment is only half-true, the whole section needs a massage, but that will happen later, this diff only touches pagedaemon parts) Testing by many, prodded by theo.
2008-06-27uvm_pglistalloc() works by walking the physical address range it gets invokedMiod Vallat
with, trying to find free pages matching the callers requirement. However, on systems with noncontiguous memory and large gaps between segments, this is a disaster as soon as one of these gaps is hit. Rewrite the logic by iterating on the physsegs, and the on the intersection of the physseg range and the callers range. This also frees us from having to check whether a given page range crosses a physseg.
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@
2008-06-14If we have one syscall that consumes large amounts of memory (like forArtur Grabowski
example an ioctl that loads bazillions of entries into a pf table) it would exhaust the pool of free pages and not let uvm_km_thread catch up until the pool was actually empty. This could be bad for non-sleeping allocators since they can't wait for the memory while the big hog can. Instead of letting the syscall exhaust the pool, detect when we fall below the low watermark, wake the thread, sleep once and let the thread catch up. This paces the huge consumer so that the more critical consumers never find an exhausted pool of pages. "seems reasonable" kettenis@
2008-06-12Bring biomem diff back into the tree after the nfs_bio.c fix went in.Theo de Raadt
ok thib beck art
2008-06-11back out biomem diff since it is not right yet. Doing very largeTheo de Raadt
file copies to nfsv2 causes the system to eventually peg the console. On the console ^T indicates that the load is increasing rapidly, ddb indicates many calls to getbuf, there is some very slow nfs traffic making none (or extremely slow) progress. Eventually some machines seize up entirely.
2008-06-10Fix buffer cache pending read statistics by ensuring we can identifyBob Beck
biowait() reads that do *not* come from the buffer cache - we use the B_RAW flag to identify these at art's suggestion - since it makes sense and the flag was not being used. this just flags all these buffers with B_RAW - biodone already ignores returned buffers marked B_RAW. ok art@
2008-06-09Define a new flag, UVM_FLAG_HOLE, for uvm_map to create a vm_map_entry ofMiod Vallat
a new etype, UVM_ET_HOLE, meaning it has no backend. UVM_ET_HOLE entries (which should be created as UVM_PROT_NONE and with UVM_FLAG_NOMERGE and UVM_FLAG_HOLE) are skipped in uvm_unmap_remove(), so that pmap_{k,}remove() is not called on the entry. This is intended to save time, and behave better, on pmaps with MMU holes at process exit time. ok art@, kettenis@ provided feedback as well.
2008-06-02Round up the numbers of keys to allocate, so that the last 128 page areaMiod Vallat
gets correctly encrypted if the swap isn't a multiple of 128 pages. ok deraadt@
2008-05-05retire ltsleep(); The only refrence left too it is in anThordur I. Bjornsson
ifdef netbsd block in drm code, but oga@ says he'll remove it soon... OK art@, oga@;
2008-04-12Prune the in-use swap encryption keys in uvm_shutdown(), per deraadt@'s idea.Miod Vallat
2008-04-12When enabling swap encryption, pass the correct number of swap pages toMiod Vallat
uvm_swap_initcrypt. The number of available pages may not match, if we are using a miniroot in the swap partition.