Commit Graph

167 Commits

Author SHA1 Message Date
reinoud ccc98bbca8 Export nestiobuf_iodone(). This allows nested iobufs to have a custom
call-back function that can then call the nestiobuf_iodone() to propagate.
2006-11-14 15:50:00 +00:00
yamt 1a7bc55dcc remove some __unused from function parameters. 2006-11-01 10:17:58 +00:00
christos b83d29dc81 with the introduction of 512 byte buffers, the index in the array is not
the number of kilobytes anymore, so name the pools appropriately.
2006-10-16 16:50:12 +00:00
christos 4d595fd7b1 - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
2006-10-12 01:30:41 +00:00
yamt 4d81bcfe21 unexport getnewbuf. 2006-09-10 06:35:42 +00:00
christos 931d28e672 use c99 initializers 2006-09-03 21:39:29 +00:00
yamt c24f70bcad move wait points for kva from upper layers to vm_map. PR/33185 #1.
XXX there is a concern about interaction with kva fragmentation.
see: http://mail-index.NetBSD.org/tech-kern/2006/05/11/0000.html
2006-05-25 14:27:28 +00:00
elad 215bd95ba4 integrate kauth. 2006-05-14 21:15:11 +00:00
uwe 7494d34448 Tell config to generate fs_ffs.h as vfs_bio.c checks for defined(FFS).
Include that header in vfs_bio.c so that bioops are not redefined.
2006-04-05 00:52:16 +00:00
tls 2ebe53e4ac Add one more buffer pool, for 512-byte buffers. On the one hand, most
systems will never, ever need this -- because they use 8k/1k or even,
these days, 16k/2k or 32k/4k filesystems.  On the other hand, when you
do need this, you *really* need it: on anoncvs.netbsd.org, for instance,
where /tmp is 4k/512 and the filesystem contains tens or even hundreds
of thousands of single-frag directories, this essentially doubles the
efficiency of the allocator.  Since the overhead of keeping one extra
pool around is minimal, just add it by default.
2006-03-17 23:43:37 +00:00
christos 81b9ed737b Move ISSET/SET/CLR macros to sys/types.h 2006-03-05 16:57:16 +00:00
yamt 14962199bf nestiobuf_iodone: remove a comment which is no longer true. 2006-02-04 12:02:35 +00:00
reinoud 0071238956 Propagate an appropiate error code in nestiobuf_iodone() to the master
buffer when the passed nested buffer has no B_ERROR flag set but not all
was transfered for the nested iobuf extent.

Discussed on tech-kern and ok'd by Takashi
2006-01-21 14:09:35 +00:00
yamt 926005485e allocbuf: yield cpu in a loop. 2006-01-15 09:01:02 +00:00
yamt 3856e837b5 - use POOL_INIT for bufpool.
- make bufiopool static.
2006-01-15 08:27:07 +00:00
yamt db2c8f4e34 add nestiobuf api for convenience when splitting a request to several pieces. 2006-01-11 00:44:41 +00:00
yamt 2addc3084c remove B_EINTR as it isn't used anymore. 2006-01-07 00:26:58 +00:00
yamt 6d5ea6e27c use a dedicated buf pool for getiobuf. 2006-01-05 10:18:20 +00:00
yamt 690d424f28 - add simple functions to allocate/free a buffer for i/o.
- make bufpool static.
2006-01-04 10:13:05 +00:00
perry a2cd732268 Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete. 2005-12-24 19:12:23 +00:00
christos 95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
atatat 420d91208b Properly fix the constipated lossage wrt -Wcast-qual and the sysctl
code.  I know it's not the prettiest code, but it seems to work rather
well in spite of itself.
2005-06-09 02:19:59 +00:00
christos efb6943313 - add const.
- remove unnecessary casts.
- add __UNCONST casts and mark them with XXXUNCONST as necessary.
2005-05-29 22:24:14 +00:00
yamt 6b2d8b66a4 merge yamt-km branch.
- don't use managed mappings/backing objects for wired memory allocations.
  save some resources like pv_entry.  also fix (most of) PR/27030.
- simplify kernel memory management API.
- simplify pmap bootstrap of some ports.
- some related cleanups.
2005-04-01 11:59:21 +00:00
chs c92634930b fix validation of new values when setting vm.{hi,low}water. fixes PR 29651. 2005-03-31 02:34:10 +00:00
perry da8abec863 nuke trailing whitespace 2005-02-26 21:34:55 +00:00
tls abcbeb46d9 Users have observed that the amount of memory used by the metadata cache
can in some situations exceed the high-water mark, and stay there once it
gets there.  Adjust the canrelease function so that it will immediately
bring us back down to the high-water mark in this situation.

How can this happen at all?  Consider a machine with two filesystems, one
with a much larger blocksize than the other.  If the small-block filesystem
is very busy, growing the cache up to the high-water mark, and then the
large-block filesystem becomes busy, buffers will be recycled (since we
are at the high-water mark) but _grow each time they're recycled_.  Once
we're above the high-water mark, the canrelease call in allocbuf (without
this change) doesn't shrink us back down below it; so things get worse and
worse.
2005-01-10 15:29:50 +00:00
dbj b2c6a6a4ea also define bioops if FFS is not defined. 2004-12-23 20:11:28 +00:00
jrf ac053b9ef0 Fix previous commit, got bufcache and bufmem messages reversed. 2004-12-05 06:12:54 +00:00
jrf cd5b5ced44 Change sysctl -d vm.bufcache to say percent of physical memory not
kernel memory. Addresses PR misc/27233. Approved by atatat@netbsd.org.
2004-12-05 06:00:20 +00:00
christos dfa8d84485 PR/25749: Peter Postma: Missing splx() in kernel. 2004-11-13 19:16:18 +00:00
enami 4fa5fd9ed6 - Testing low memory condition to see if we should alloc or not doesn't make
sense, since 1) the condition is quite normal condition and 2) there is
  pool between us and uvm.
- Make the step of allocation possibility a bit seamless by moving the origin
  of curve from 0 to lowater mark.
Simon told that this helps for interactive performance when there is heavy
disk activity in PR#27057.
2004-10-04 01:24:18 +00:00
enami 51718e92ee Factor out code to set watermark and ensure high > low. 2004-10-04 00:46:05 +00:00
enami 682c3c9443 - Don't let pagedaemon sleep while draining buf.
- Estimate amount of memory to free at a time.
Address PR#27057 (and similar hangs I saw several months ago).
2004-10-03 08:47:48 +00:00
enami ba25820566 x > 15 is always false if x is 0 .. 15.
# XXX: testing free memory here is quite doubtful.  also, I guess lowater
# XXX: is better than 0 as origin.
2004-10-03 08:30:09 +00:00
enami 778d21de43 Cheap test first. 2004-10-03 08:17:54 +00:00
yamt 3362d4ed5b fix allocbuf() O(n**2) behaviour where n is number of AGE buffers
by always tracking amount of buffers on a queue.
bump to 2.0H.
2004-09-18 16:37:12 +00:00
yamt 2bf1a4ef17 - add missing function prototypes.
- fix prototype mismatches.
2004-09-18 16:01:03 +00:00
yamt d08391b2a3 buf_trim: a buffer grabbed by getnewbuf() should be clean and anonymous.
thus, there's no need to check and handle B_WANTED here.
2004-09-08 10:20:15 +00:00
hannken 7a5be5a9ff - Add flag L_COWINPROGRESS to struct lwp to avoid recursion when
doing copy-on-write.

- Change VFS_SNAPSHOT() to return the snapshot vnode locked.

- Make the IO path for copy-on-write and snapshot-read more lightweight.
  Avoids deadlocks where vn_rdwr(...READ...) has a shared lock and needs
  to copy-on-write.
  Avoids deadlocks/panics where to clean pages the copy-on-write needs
  to allocate pages for its VOP_PUTPAGES().

L_COWINPROGRESS part approved by: Jason R. Thorpe <thorpej@netbsd.org>
2004-06-20 18:55:58 +00:00
thorpej 3183ea47c2 When initializing the buffer cache memory pools where the size <= PAGE_SIZE,
also use the standard allocator on systems that use a direct-mapped memory
segment for mapping pool pages.
2004-06-20 18:29:47 +00:00
thorpej bbbb3183d6 Don't use PR_IMMEDRELEASE on buffer cache pools. Instead, set a high
water mark of 1, which will have the same effect.

Pointed out back in January by YAMAMOTO Takashi.
2004-06-20 18:17:09 +00:00
atatat 5b22e79ada Remaining sysctl descriptions under kern subtree 2004-05-25 04:30:32 +00:00
yamt ab195ed32f bio_doread: vp is always non-NULL here. 2004-04-25 12:41:12 +00:00
christos 6bd1d6d4db Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
2004-04-21 01:05:31 +00:00
simonb 1c13fd358f Give buf_lotsfree() a bit of a service:
- Fix a 32-bit overflow that could erroneously return true even if the
  currently allocated buffer memory was greater than the high water mark.
- Add an early check for bufmem > hiwater to avoid a needless call to
  random().
- Sprinkle some comments.

Add a vm.bufmem sysctl so the current bufmem value can be easily queried
from userland.

Reviewed by Thor Simon.
2004-03-26 00:31:55 +00:00
simonb 07056cd3d1 More white space nits. 2004-03-25 23:17:16 +00:00
simonb c67d420cbf White-space nit. 2004-03-25 08:22:31 +00:00
atatat 19af35fd0d Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.
2004-03-24 15:34:46 +00:00
dan 5819919614 micro-optimisation - if we're going to return 0, do so before doing
other unnecessary work
2004-02-22 01:00:41 +00:00