summaryrefslogtreecommitdiff
path: root/sys/uvm/uvm_km.c
AgeCommit message (Collapse)Author
2015-09-26Protect the list of free map entries with a mutex. This should fix theMark Kettenis
crashes seen by sthen@ on i386. ok visa@, guenther@, tedu@
2015-09-17Back out rev. 1.125. This bit was left behind (intentionally?) when theMark Kettenis
remainder of that commit was backed out. However,clearing the PQ_AOBJ bit here is definitely wrong. Our pagedaemon uses two separate lists to keep track of inactive pages. It uses PQ_SWAPBACKED, which really is both PQ_ANON and PQ_AOBJ to keep track of which inactive queue a page is sitting on. So if you twiddle PQ_AOBJ (or PQ_ANON) for an inactive page, a subsequent uvm_pagefree(9) will remove the page from the wrong queue! This usually goes unnoticed, but if the page happens to be the last one on the queue, the queues get corrupted. The damage quickly spreads to the free page queues and almost certainly results in the uvm_pmr_size_RB_REMOVE_COLOR() faults that people have seen sporadically since the spring of this year. ok visa@, beck@, krw@, guenther@
2015-02-07Introduce VM_KERNEL_SPACE_SIZE as a replacement forMiod Vallat
(VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS). This will allow these to no longer be constants in the future. ok guenther@
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
2015-01-23Make km_alloc(9) use the direct map for all "phys contig" mappings requestedMark Kettenis
by the caller on architectures that implement them. Make sure that we physically align memory such that we meet any demands on virtual alignment in this case. This should reduce the overhead of mapping large pool pages for pools that request dma'able memory. ok deraadt@, dlg@
2014-12-17Prefer MADV_* over POSIX_MADV_* in kernel for consistency: the latterPhilip Guenther
doesn't have all the values and therefore can't be used everywhere. ok deraadt@ kettenis@
2014-12-15Use MAP_INHERIT_* for the 'inh' argument to the UMV_MAPFLAG() macro,Philip Guenther
eliminating the must-be-kept-in-sync UVM_INH_* macros ok deraadt@ tedu@
2014-11-27The sti(4) driver copies its ROM into kernel memory and executes the codeMark Kettenis
in there. It explicitly changes the mapping of that memory to RX, but this only works if the maximum protection of the mapping includes PROT_EXEC. ok miod@, deraadt@
2014-11-21Kill kv_executable flag. We no longer allow requests for PROT_EXECTheo de Raadt
mappings via this interface (nothing uses it, in any case) ok uebayasi tedu
2014-11-17More cases of kernel map entries being created as EXEC by default; notTheo de Raadt
just the base permission but the maxprot as well. ok tedu
2014-11-17There is no reason for uvm_km_alloc1() to allocate kernel memoryTheo de Raadt
that is executable. ok tedu kettenis guenther
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-11-13bzero -> memsetTed Unangst
2014-09-14remove uneeded proc.h includesJonathan Gray
ok mpi@ kspillner@
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-06-21Make sure kmthread never loops without making progress: if the freelistPhilip Guenther
was empty then the first page allocation should sleep until it can get one. ok tedu@
2014-04-13compress code by turning four line comments into one line comments.Ted Unangst
emphatic ok usual suspects, grudging ok miod
2013-05-30in the brave new world of void *, we don't need caddr_t castsTed Unangst
2013-05-30UVM_UNLOCK_AND_WAIT no longer unlocks, so rename it to UVM_WAIT.Ted Unangst
2013-05-30remove simple_locks from uvm code. ok beck deraadtTed Unangst
2012-11-10Number of swap pages in use must be smaller than tha total number of swapMark Kettenis
pages, so fix non-sensical comparison introduced in rev 1.77. ok miod@, krw@, beck@
2012-03-09New vmmap implementation.Ariane van der Steldt
no oks (it is really a pain to review properly) extensively tested, I'm confident it'll be stable 'now is the time' from several icb inhabitants Diff provides: - ability to specify different allocators for different regions/maps - a simpler implementation of the current allocator - currently in compatibility mode: it will generate similar addresses as the old allocator
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-23Don't bother checking for an empty queue before calling uvm_pglistfree.Owain Ainsworth
It will handle an empty list just fine (there's a small optimisation possible here to avoid grabbing the fpageqlock if no pages need freeing, but that is definitely another diff) ok ariane@
2011-06-23Make mbufs and dma_alloc be contig allocations.Ariane van der Steldt
Requested by dlg@ ok oga@
2011-06-06Backout vmmap in order to repair virtual address selection algorithmsAriane van der Steldt
outside the tree.
2011-05-24Reimplement uvm/uvm_map.Ariane van der Steldt
vmmap is designed to perform address space randomized allocations, without letting fragmentation of the address space go through the roof. Some highlights: - kernel address space randomization - proper implementation of guardpages - roughly 10% system time reduction during kernel build Tested by alot of people on tech@ and developers. Theo's machines are still happy.
2011-05-10Don't leak swapslots when doing a uvm_km_pgremove and a page is in swap only.Owain Ainsworth
Before we were only calling uao_dropswap() if there was a page, maning that if the buffer was swapped out then we would leak the slot. Quite rare because only pipebuffers should swap from the kernel object, but i've seen panics that implied this had happened (alpha.p for example). ok thib@ after a lot of discussion and checking the semantics.
2011-04-23Fix management of the list of free uvm_km_pages. Seems art@ lost a lineMark Kettenis
when he copied this code from uvm_km_putpage() into km_free(). Found independently by ariane@; ok deraadt@
2011-04-19Add missing call to pmap_update() in km_alloc().Matthew Dempsky
ok deraadt@, miod@
2011-04-19Free the correct pages when we failed to allocate va.Artur Grabowski
2011-04-18Put back the change of pool and malloc into the new km_alloc(9) api.Artur Grabowski
The problems during the hackathon were not caused by this (most likely). prodded by deraadt@ and beck@
2011-04-15unused variable on !PMAP_DIRECTTheo de Raadt
2011-04-15move uvm_pageratop from uvm_pager.c local to a general uvm functionOwain Ainsworth
(uvm_atopg) and use it in uvm_km_doputpage to replace some handrolled code. Shrinks the kernel a trivial amount. ok beck@ and miod@ (who suggested i name it uvm_atopg not uvm_atop)
2011-04-07Do not use NULL in integer comparisons. No functional change.Miod Vallat
ok matthew@ tedu@, also eyeballed by at least krw@ oga@ kettenis@ jsg@
2011-04-06Backout the uvm_km_getpage -> km_alloc conversion. Weird things are happeningArtur Grabowski
and we aren't sure what's causing them. shouted oks by many before I even built a kernel with the diff.
2011-04-05 - Change pool constraints to use kmem_pa_mode instead of uvm_constraint_rangeArtur Grabowski
- Use km_alloc for all backend allocations in pools. - Use km_alloc for the emergmency kentry allocations in uvm_mapent_alloc - Garbage collect uvm_km_getpage, uvm_km_getpage_pla and uvm_km_putpage ariane@ ok
2011-04-04Few minor ninja fixes while this isn't being used anywhere in -current.Artur Grabowski
- Change a few KASSERT(0) into proper panics. - Match the new behavior of single page freeing. - kremove pages and then free them, it's safer. thib@ ok
2011-04-04Better.Artur Grabowski
2011-04-04Make gcc stop whining. pointed out by ariane@.Artur Grabowski
2011-04-04Some minor fixes:Artur Grabowski
- Clarify a comment. - Change all the flags to chars from ints to make the structs smaller.
2011-04-04New unified allocator of kernel memory.Artur Grabowski
We've reached the point where we have a dozen allocators that all do more or less the same thing, but slightly different, with slightly different semantics, slightly different default behaviors and default behaviors that most callers don't expect or want. A random sample on the last general hackathon showed that no one could explain what all the different allocators did. And every time someone needed to do something slightly different a new allocator was written. Unify everything. One single function to allocate multiples of PAGE_SIZE kernel memory. Four arguments: size, how va is allocated, how pa is allocated and misc parameters. Same parameters are passed to the free function so that we don't need to guess what's going on. Functions are currently unused, we'll do one thing at a time to avoid a giant commit. looked at by lots of people, deraadt@ and beck@ are yelling at me to commit.
2010-08-26make the comment explaining the kernel submaps a bit better.Thordur I. Bjornsson
ok art@, oga@
2010-07-22Remove the VM_KMPAGESFREE sysctl. After the pmemrangeThordur I. Bjornsson
changes it was returing a constant 0, changing to cope with those changes makes less sense then just removing as it provides the user with no usefull information. sthen@ grepped the port's tree for me and found not hits, thanks! OK deraadt@, matthew@
2010-07-15the uvm_km_putpage is calling into tangly uvm guts again on not pmap direct.Ted Unangst
go back to something more like the previous design, and have the thread do the heavy lifting. solves vmmaplk panics. ok deraadt oga thib [and even simple diffs are hard to get perfect. help from mdempsky and deraadt]
2010-07-02no need to call uvm_km_free_wakup for the kernel map, uvm_km_free isThordur I. Bjornsson
enough. ok tedu@, art@
2010-07-02add an align argument to uvm_km_kmemalloc_pla.Artur Grabowski
Use uvm_km_kmemalloc_pla with the dma constraint to allocate kernel stacks. Yes, that means DMA is possible to kernel stacks, but only until we've fixed all the scary drivers. deraadt@ ok
2010-07-02Drop the uvm_km_pages.mtx mutex in uvm_km_putpage before we free va's,Thordur I. Bjornsson
as calls to uvm_km_free_wakup can end up in uvm_mapent_alloc which tries to grab this mutex. ok tedu@
2010-06-29Add a no_constraint uvm_constraint_range; use it in the pool code.Thordur I. Bjornsson
ok tedu@, beck@, oga@
2010-06-28Move uvm_km_pages struct declaration and watermark bounds to uvm_km.h, soMiod Vallat
that md code can peek at it, and update m68k !__HAVE_PMAP_DIRECT setup code to the recent uvm_km changes. ok thib@