From owner-freebsd-hackers Tue Apr 1 06:40:48 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id GAA04469 for hackers-outgoing; Tue, 1 Apr 1997 06:40:48 -0800 (PST) Received: from life.eecs.umich.edu (pmchen@life.eecs.umich.edu [141.213.8.32]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id GAA04464 for ; Tue, 1 Apr 1997 06:40:44 -0800 (PST) Received: (from pmchen@localhost) by life.eecs.umich.edu (8.8.5/8.8.0) id JAA26225 for freebsd-hackers@freebsd.org; Tue, 1 Apr 1997 09:39:42 -0500 (EST) Date: Tue, 1 Apr 1997 09:39:42 -0500 (EST) From: "Peter M. Chen" Message-Id: <199704011439.JAA26225@life.eecs.umich.edu> To: freebsd-hackers@freebsd.org Subject: question on buffer cache and VMIO Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Hi, I'm starting to hack on FreeBSD and had some questions. Background: My goal is to make the file cache reliable without writing to disk under normal operation (see Rio paper in ASPLOS 1996). We protect against power loss by using a battery; we protect against kernel crashes by write-protecting the file cache. The main benefit is you get reliability equivalent to mounting the file system sync, yet with the performance of async (actually even better, since FreeBSD's async option still does substantial amounts of I/O). This works really well for mmap'ed files, which makes it possible to have VERY fast transactions. It should also extend the battery life for portables. See http://www.eecs.umich.edu/~pmchen/ for more info. Questions re: buffer cache and VMIO 1) What's the relationship between the buffer cache and VM cache (I'm not sure this is the proper terminology)? The buffer cache seems to hold file data and metadata, while the VM cache holds only file data. Do buffer headers point to the VM cache data? Can the VM cache hold file data that is not in the buffer cache? 2) The buffer cache seems small relative to the physical memory. E.g. on a 64 MB machine (51 MB available), maxbufspace defaults to only 6.3 MB. For working sets larger than this, there appears to be significant overhead in frequently moving data between the VM cache and buffer cache. Would it make sense to set NBUF larger (e.g. enough to have the buffer cache fill memory)? 3) Dirty data gets written to disk when it leaves the buffer cache, even if it is also in the VM cache. This makes sense normally (since Unix traditionally bawrote data to disk as soon as it filled a block), but this prevents my keeping lots of dirty file data around. 4) What happens to mmap'ed data? Does it reside in the VM cache? Are there buffer headers for mmap'ed data? 5) I came across a strange phenomenon when trying to get rid of all disk writes in ufs_remove. Even if i_nlink goes to 0, the file is still fsync'ed. The call graph is: ufs_remove -> vput -> vrele -> vm_object_deallocate -> vm_object_terminate -> vinvalbuf (with V_SAVE) -> VOP_FSYNC. The system fails when I have vm_object_terminate check for i_nlink and call vinvalbuf without V_SAVE. Can someone explain why a deleted file needs to get fsynced (note that this isn't the directory, but the actual file)? General kernel questions: 1) I'd like the ability to read and write kernel global variables (without going to ddb). I tried kvm, but that only works for variables in i386/i386/symbols.raw. kgdb only works for off-line core dumps. I finally used nm to get the symbol address and directly read and wrote to /dev/kmem. This works fine, but I was wondering if there's a better solution that exists already. By the way, I've been SUPER impressed with FreeBSD. The code is well-written, especially compared to other operating systems I've worked on; Compiling the kernel is VERY fast; the system is fast and small; the installation process is easy; the small number of packages and ports I've tried work right away; the boot manager understands the file system. It has the feel of a solid, well-put-together system. Thanks for your time, Pete Prof. Peter M. Chen EECS Department, 2225 EECS 1301 Beal Ave. University of Michigan Ann Arbor, MI 48109-2122 (313) 763-4472, fax: (313) 763-4617 pmchen@eecs.umich.edu http://www.eecs.umich.edu/~pmchen/