summaryrefslogtreecommitdiff
path: root/sys/uvm
AgeCommit message (Collapse)Author
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.
2008-04-10Correctly amount swap usage for anons, from NetBSD via PR 5772.Miod Vallat
2008-04-09Add new stub uvm_shutdown() and call it from the right place in MD boot()Theo de Raadt
2008-03-02Include sigcode in core dumps. This makes it possible to backtraceMark Kettenis
through signal handlers with gdb. ok miod@
2008-02-27Don't dump duplicate data in stack segments of core dumps when the stackMark Kettenis
memory map is fragmented. Avoids ridiculously large core dumps. ok miod@
2008-02-17Add back cast in ptoa() to prevent problems with integer overflow.Mark Kettenis
Proper casts should be added to all invocations of ptoa() before this cast can be removed again. ok toby@, marco@, miod@
2008-01-09Make uvm_page_lookup_freelist() simpler and faster if VM_PHYSSEG_MAX is 1.Miod Vallat
Has been in snapshots for a short while.
2008-01-05Mark vadvise(2) as obsolete and remove its implementation, so instead ofMiod Vallat
returning EINVAL, you'll get ENOSYS. No serious code has used this system call in at least fifteen years. The libc stub will be removed at the next major crank time. ok henning@ deraadt@ krw@ toby@
2008-01-04Only compile in uvm_page_physdump() if option DDB as it's not directly callableMiod Vallat
and supposed to be only used from within ddb.
2007-12-18Turn the uvm_{lock/unlock}_fpageq() inlines intoThordur I. Bjornsson
macros that just expand into the mutex functions to keep the abstraction, do assorted cleanup. ok miod@,art@
2007-12-16Correctly calculate stack increment for MACHINE_STACK_GROWS_UP; fixes problemsMark Kettenis
where core dumps on hppa were missing the last stack page. ok miod@
2007-12-15export kernel uvm_km_pages_free as vm.kmpagesfree; ok tedu, tested jsgTheo de Raadt
2007-12-11use a mutex for protection of the uvm_km list. ok artTed Unangst
2007-11-29use a working mutex for the freepage list. ok art deraadtTed Unangst
2007-11-27Shoot old netbsd compat code from almost 20 years ago; ok artTheo de Raadt
2007-11-26In uvm_aio_aiodone(), kill the variable-sized array on stack, and use aMiod Vallat
fixed size array which size should match any buf; if a bogus buf is passed to this function, the kernel will KASSERT instead of potentially running out of stack and having an undefined behaviour. ok deraadt@
2007-10-29MALLOC/FREE -> malloc/freeCharles Longeau
ok krw@
2007-10-10Make context switching much more MI:Artur Grabowski
- Move the functionality of choosing a process from cpu_switch into a much simpler function: cpu_switchto. Instead of having the locore code walk the run queues, let the MI code choose the process we want to run and only implement the context switching itself in MD code. - Let MD context switching run without worrying about spls or locks. - Instead of having the idle loop implemented with special contexts in MD code, implement one idle proc for each cpu. make the idle loop MI with MD hooks. - Change the proc lists from the old style vax queues to TAILQs. - Change the sleep queue from vax queues to TAILQs. This makes wakeup() go from O(n^2) to O(n) there will be some MD fallout, but it will be fixed shortly. There's also a few cleanups to be done after this. deraadt@, kettenis@ ok
2007-09-17instead of inspecting the vnode op's to figure out ifThordur I. Bjornsson
vnode locking actually works, just check the VLOCKSWORK flag. Also, change this ifdef DEBUG to VFSDEBUG since VLOCKSWORK is only ever set if VFSDEBUG is defined. ok/input miod@, art@ (earlier diff)
2007-09-15replace ctob and btoc with ptoa and atop respectivelyMartin Reindl
help and ok miod@ thib@
2007-09-10Introduce a md pmap hook, pmap_remove_holes(), which is supposed to markMiod Vallat
the holes a MMU may have from a given vm_map. This will be automagically invoked for newly created vmspaces. On platforms with MMU holes (e.g. sun4, sun4c and vax), this prevents mmap(2) hints which would end up being in the hole to be accepted as valid, causing unexpected signals when the process tries to access the hole (since pmap can not fill the hole anyway). Unfortunately, the logic mmap() uses to pick a valid address for anonymous mappings needs work, as it will only try to find an address higher than the hint, which causes all mmap() with a hint in the hole to fail on vax. This will be improved later.
2007-09-07Use M_ZERO in a few more places to shave bytes from the kernel.Artur Grabowski
eyeballed and ok dlg@
2007-09-01replace the machine dependant bytes-to-clicks macro by the MI ptoa()Martin Reindl
version for i386 more architectures and ctob() replacement is being worked on prodded by and ok miod
2007-08-31simplify uvm_vnp_sync() by removing some simplelock goo.Thordur I. Bjornsson
some comment cleanup and a touch of KNF. ok art@
2007-08-03Don't let pagedaemon wait for pages here. We could trigger this easilyArtur Grabowski
when we hit swap before actually fully populating the buffer cache which would lead to deadlocks. From pedro, tested by many, deraadt@ ok
2007-07-18Indentation nit.Artur Grabowski
2007-06-18Bring back Mickey's UVM anon change. Testing by thib@, beck@ andPedro Martelletto
ckuethe@ for a while. Okay beck@, "it is good timing" deraadt@.
2007-06-13Remove some statics and inlines (mostly to get a readable profile output).Artur Grabowski
"reads ok" dlg@
2007-06-06now that all partition size/offsets are potentially 64-bit, change theTheo de Raadt
type of all variables to daddr64_t. this includes the APIs for XXsize() and XXdump(), all range checks inside bio drivers, internal variables for disklabel handling, and even uvm's swap offsets. re-read numerous times by otto, miod, krw, thib to look for errors
2007-06-05use six new macros to access & store the 48-bit disklabel fields relatedTheo de Raadt
to size. tested on almost all machines, double checked by miod and krw next comes the type handling surrounding these values
2007-06-01set hiwat mark for some of the more popular pools to reduce bouncingTed Unangst
ok art bob
2007-06-01wrong cast checking for VOP_BMAP return value; ok miodTheo de Raadt
2007-05-31zap the vm_amap am_l simplelock, and amap_{lock/unlock} macros forThordur I. Bjornsson
simple_{lock/unlock}. ok art@