summaryrefslogtreecommitdiff
path: root/sys/kern/vfs_bio.c
AgeCommit message (Collapse)Author
2016-03-17- add realloc_pages to move a buffer's physmem from one range to another.Bob Beck
- modify B_DMA handling to be in vfs_biomem.c - change buffer allocation to try allocations with NOWAIT and to throw away clean pages if allocation fails - allocate with WAITOK only if you can't throw away enough pages to succeed "probably sound" deraadt@
2016-03-10Start some refactoring in here. this gets bufadjust outBob Beck
of the hibernate path and starts preparing for some other work in here
2016-03-06Do not fetch the same block multiple times if it is already presentMartin Pieuchot
in the buffer cache. When the Dynamic Buffer Cache has been introduced bread_cluster() became the replacement of cluster_read(). However this function did not consider the B_CACHE flag of the first buffer of a cluster like its predecessor did. This improves a lot read operations on MSDOSFS while reducing the number of DMA operations. ok beck@
2015-11-28move buffer size adjustment to buf_adjcnt - from Walter NetoBob Beck
ok mpi@
2015-07-19Use two 2q caches for the buffer cache, moving previously warm buffers from theBob Beck
first queue to the second. Mark the first queue as DMA in preparation for being able to use more memory by flipping. Flipper code currently only sets and clears the flag. ok tedu@ guenther@
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-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-01-18Revert 1.166 (but keep the bufq_wait() interface change), for this is wrongMiod Vallat
and the bufq pointer might be NULL at the time it is `saved'. Found the hard way on sparc due to the limited kva, with all disk active processes ending up sleeping on "buf_needva". ok kettenis@ krw@
2015-01-09save the bufq pointer from the buf before we turn it loose so it won'tTed Unangst
change on us. also, remove unused second arg to bufq_wait. from pedro at bitrig via david hill. ok beck kettenis
2014-12-16primary change: move uvm_vnode out of vnode, keeping only a pointer.Ted Unangst
objective: vnode.h doesn't include uvm_extern.h anymore. followup changes: include uvm_extern.h or lock.h where necessary. ok and help from deraadt
2014-12-11typos; from kaspars bankovskisJason McIntyre
2014-10-08Now that the cleaner yields the cpu, we can stop checkingBret Lambert
to see if we've hogged the cpu for >1 second. okay miod@
2014-09-09Make the cleaner, syncer, pagedaemon, aiodone daemons allBret Lambert
yield() if the cpu is marked SHOULDYIELD. ok miod@ tedu@ phessler@
2014-08-31replace LRU bufcache with something originally modelled after 2Q.Ted Unangst
this should provide a degree of scan resistance, and also serves as a midway point for further development of multi queue algorithms. i've tried to minimize the risk and degree of regressions. probably ok beck
2014-07-13trim some castsTed Unangst
2014-07-13use mallocarray where arguments are multipled. ok deraadtTed Unangst
2014-07-12add a size argument to free. will be used soon, but for now default to 0.Ted Unangst
after discussions with beck deraadt kettenis.
2014-07-11Flush the buffercache to 16MB on hibernate and restore its previous maxMike Larkin
size (kern.bufcachepercent) on resume, for better hibernate performance. ok beck@
2014-07-08decouple struct uvmexp into a new file, so that uvm_extern.h and sysctl.hTheo de Raadt
don't need to be married. ok guenther miod beck jsing kettenis
2014-04-10pull the bufcache freelist code out into separate functions to allow newTed Unangst
algorithms to be tested. in the process, drop support for unused B_AGE and b_synctime options. previous versions ok beck deraadt
2014-01-25get rid of the kernel high and low water marks for pages and replace withBob Beck
a single target of used pages in the cache - so we don't to a ton of work throwing away pages sporadically while holding the biglock - noticed by dlg. ok dlg@ deraadt@
2013-12-09Don't keep removed files (B_INVAL bufs) in the buffer cache. Free buffersBob Beck
once brelse() is called and the buffer is B_INVAL. ok jsing@ krw@
2013-08-08Uncomment kprintf format attributes for sys/kernSylvestre Gallon
tested on vax (gcc3) ok miod@
2013-07-09back out the cache flipper temporarily to work out of tree.Bob Beck
will come back soon. ok deraadt@
2013-06-13beck would prefer to keep things just as they were for a while longer.Ted Unangst
undo style changes.
2013-06-11sprinkle knf fairy dust over new buf codeTed Unangst
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-06-11final removal of daddr64_t. daddr_t has been 64 bit for a long enoughTheo de Raadt
test period; i think 3 years ago the last bugs fell out. ok otto beck others
2013-02-17Comment out recently added __attribute__((__format__(__kprintf__))) annotationsMiod Vallat
in MI code; gcc 2.95 does not accept such annotation for function pointer declarations, only function prototypes. To be uncommented once gcc 2.95 bites the dust.
2013-02-09Add explicit __attribute__ ((__format__(__kprintf__)))) to the functions andMiod Vallat
function pointer arguments which are {used as,} wrappers around the kernel printf function. No functional change.
2013-01-18Give buf_acquire_unmapped and B_NOTMAPPED a viking funeral as they shouldBob Beck
really have been called "maybemapped and hope it all works out". - use buf_acquire_nomap instead which acounts for busymapped bufs correctly. ok krw@ guenther@ kettenis@
2013-01-13After some discussion with deraadt and kettenis, revert previous decision toBob Beck
set a high water mark, as this will likely cause us problems in low memory situations where we can't get a struct buf. ok kettenis@
2012-12-28Avoid spinning in the cleaner when there are insufficient clean pages, butJoel Sing
there are no buffers on the dirty queue to clean. ok beck@
2012-12-02Fix kva reserve - ensure that kva reserve is checked for, as wellBob Beck
as fix the case where buffers can be returned on the vinvalbuf path and we do not get woken up when waiting for kva. An earlier version looked at and ok'd by guenther@ in coimbra. - helpful comments from kettenis@
2012-12-02Don't wake the cleaner and potentially throw away pages we shouldn'tBob Beck
be throwing away when growing the buffer cache - ok mlarkin@
2012-11-07Fix the buffer cache.Bob Beck
A long time ago (in vienna) the reserves for the cleaner and syncer were removed. softdep and many things have not performed ths same ever since. Follow on generations of buffer cache hackers assumed the exising code was the reference and have been in frustrating state of coprophagia ever since. This commit 0) Brings back a (small) reserve allotment of buffer pages, and the kva to map them, to allow the cleaner and syncer to run even when under intense memory or kva pressure. 1) Fixes a lot of comments and variables to represent reality. 2) Simplifies and corrects how the buffer cache backs off down to the lowest level. 3) Corrects how the page daemons asks the buffer cache to back off, ensuring that uvmpd_scan is done to recover inactive pages in low memory situaitons 4) Adds a high water mark to the pool used to allocate struct buf's 5) Correct the cleaner and the sleep/wakeup cases in both low memory and low kva situations. (including accounting for the cleaner/syncer reserve) Tested by many, with very much helpful input from deraadt, miod, tobiasu, kettenis and others. ok kettenis@ deraadt@ jj@
2012-10-16Cleanup.Bob Beck
- Whitespace KNF - Removal/fixing of old useless comments - Removal of unused counter - Removal of pointless test that had no effect ok krw@
2012-10-09bufq write limitingBob Beck
This change ensures that writes in flight from the buffer cache via bufq are limited to a high water mark - when the limit is reached the writes sleep until the amount of IO in flight reaches a low water mark. This avoids the problem where userland can queue an unlimited amount of asynchronous writes resulting in the consumption of all/most of our available buffer mapping kva, and a long queue of writes to the disk. ok kettenis@, krw@
2012-05-30Fix a few issues in the pressure logic when the available buffers run low:Miod Vallat
- make sure the buffer reclaiming loop in buf_get() actually does something but spin, if `backoffpages' is nonzero and all free queues have been drained. - don't forget to set a poor man's condition variable to nonzero before tsleeping on it in bufadjust(), otherwise you'll never get woken up. - don't be too greedy and reassing backoffpages a large amount immediately after bufadjust() has been called. This fixes reproduceable hangs seen during heavy I/O (such as `make install' of many large files, e.g. run in /usr/src/lib with NOMAN=) on systems with a challenged number of pages (less than a few thousands, total). Part of this is temporary bandaid until a better pressure logic is devised, but it's solving an immediate problem. Been in snapshots for a solid month.
2012-03-23Make rusage totals, itimers, and profile settings per-process insteadPhilip Guenthe
of per-rthread. Handling of per-thread tick and runtime counters inspired by how FreeBSD does it. ok kettenis@
2011-09-19clean up buffer cache statistics somewhat toBob Beck
remove some now useless statistics, and add some relevant ones regarding kva usage in the cache. make systat io and show bcstats in ddb both show these counters. ok deraadt@ krw@
2011-07-06the rest of the uvm commit - I commited from uvm instead of sysBob Beck
(part missed from previous commit)
2011-07-04move the specfs code to a place people can see it; ok guenther thib krwTheo de Raadt
2011-07-04bread does nothing with its ucred argument. remove it. ok matthewTed Unangst
2011-06-05Move the bufcachepercent setting code to MI locations -- set it to 42%Theo de Raadt
for now; that is unlikely to hit some of the remaining starvation bugs. Repair the bufpages calculation too; i386 was doing it ahead of time (incorrectly) and then re-calculating it. ok thib
2011-04-07Revert previous diff decrementing bcstats.numbufpages here. This functionBob Beck
does not do what it purports to do, it shrinks mapping, not allocation, as the pages have already been given away to other buffers. This also renames the function to make this a little more obvious and art should not name funcitons ok thib@, art@
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@
2010-11-13backout 1.86Theo de Raadt
it is totally wrong to convert bdwrite into bawrite on the fly. this just causes way bigger issues. ok beck blambert
2010-08-03matthew did not commit the diff he passed around for us to inspect...Theo de Raadt
repair that situation. Darn newbies...
2010-08-03If an asynchronous request invalidates a buf, then we might remove itMatthew Dempsky
from its vnode's buffer cache in an interrupt context. Therefore we need interrupt protection when searching the buffer red-black tree. ok deraadt@, thib@, art@