Date: Tue, 06 Oct 1998 15:00:21 +0200 From: Stefan Eggers <seggers@semyam.dinoco.de> To: freebsd-current@FreeBSD.ORG Cc: seggers@semyam.dinoco.de Subject: Text: Locking in the kernel's VM subsystem Message-ID: <199810061300.PAA05872@semyam.dinoco.de>
next in thread | raw e-mail | index | archive | help
Surely someone knows more than I do about this but noone seems to have written a few bits about locking in the VM subsystem, yet. ;-) So this is a first and surely in many places incorrect description of how it is supposed to work. Comments and corrections welcome. Stefan. ---------------------------------------------------------------------- Locking in the VM subsystem In the following text o denotes a VM object, p is a VM page. splvm()/splx() Similar to the other spl...() calls. o->paging_in_progress Indicator for paging going on on pages within this object. p->busy/vm_page_io_start()/vm_page_io_finish() vm_page_io_start() marks a page as busy for I/O use - usually this is happening due to filesystem accesses. The reverse operation is vm_page_io_finish() which also does the wakeup of processes waiting for the page. NOTE: This is different from setting the busy flag! You have to check both if you want to make sure a page is really non-busy. p->flags & PG_BUSY/vm_page_busy()/vm_page_wakeup() This marks a page as busy for some operation. Using the functions ensures the operation of setting/clearing the flags is atomar and also does a wakeup of processes waiting for this page to become non-busy when necessary. NOTE: This is different from setting the busy counter! You have to check both if you want to make sure a page is really non-busy. p->hold_count/vm_page_hold()/vm_page_unhold() Used (if non-zero) to indicate someone has a reference to this page. One better doesn't make this reference invalid in any way. p->wire_count Wired pages are those which don't get paged anymore. The are also fixed at their position. Useful for making something unmoveable during I/O for example. vm_page_flag_set()/vm_page_flag_clear() Generic flag set/clear operation used for example by vm_page_busy()/ vm_page_wakeup(). Ensures that the operation is atomic. ---------------------------------------------------------------------- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199810061300.PAA05872>