vm_pageout.h revision 1817
11541Srgrimes/* 21541Srgrimes * Copyright (c) 1991, 1993 31541Srgrimes * The Regents of the University of California. All rights reserved. 41541Srgrimes * 51541Srgrimes * This code is derived from software contributed to Berkeley by 61541Srgrimes * The Mach Operating System project at Carnegie-Mellon University. 71541Srgrimes * 81541Srgrimes * Redistribution and use in source and binary forms, with or without 91541Srgrimes * modification, are permitted provided that the following conditions 101541Srgrimes * are met: 111541Srgrimes * 1. Redistributions of source code must retain the above copyright 121541Srgrimes * notice, this list of conditions and the following disclaimer. 131541Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 141541Srgrimes * notice, this list of conditions and the following disclaimer in the 151541Srgrimes * documentation and/or other materials provided with the distribution. 161541Srgrimes * 3. All advertising materials mentioning features or use of this software 171541Srgrimes * must display the following acknowledgement: 181541Srgrimes * This product includes software developed by the University of 191541Srgrimes * California, Berkeley and its contributors. 201541Srgrimes * 4. Neither the name of the University nor the names of its contributors 211541Srgrimes * may be used to endorse or promote products derived from this software 221541Srgrimes * without specific prior written permission. 231541Srgrimes * 241541Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 251541Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 261541Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 271541Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 281541Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 291541Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 301541Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 311541Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 321541Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 331541Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 341541Srgrimes * SUCH DAMAGE. 351541Srgrimes * 361817Sdg * from: @(#)vm_pageout.h 8.2 (Berkeley) 1/12/94 371541Srgrimes * 381541Srgrimes * 391541Srgrimes * Copyright (c) 1987, 1990 Carnegie-Mellon University. 401541Srgrimes * All rights reserved. 411541Srgrimes * 421541Srgrimes * Author: Avadis Tevanian, Jr. 431541Srgrimes * 441541Srgrimes * Permission to use, copy, modify and distribute this software and 451541Srgrimes * its documentation is hereby granted, provided that both the copyright 461541Srgrimes * notice and this permission notice appear in all copies of the 471541Srgrimes * software, derivative works or modified versions, and any portions 481541Srgrimes * thereof, and that both notices appear in supporting documentation. 491541Srgrimes * 501541Srgrimes * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 511541Srgrimes * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 521541Srgrimes * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 531541Srgrimes * 541541Srgrimes * Carnegie Mellon requests users of this software to return to 551541Srgrimes * 561541Srgrimes * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 571541Srgrimes * School of Computer Science 581541Srgrimes * Carnegie Mellon University 591541Srgrimes * Pittsburgh PA 15213-3890 601541Srgrimes * 611541Srgrimes * any improvements or extensions that they make and grant Carnegie the 621541Srgrimes * rights to redistribute these changes. 631817Sdg * 641817Sdg * $Id$ 651541Srgrimes */ 661541Srgrimes 671541Srgrimes/* 681541Srgrimes * Header file for pageout daemon. 691541Srgrimes */ 701541Srgrimes 711541Srgrimes/* 721541Srgrimes * Exported data structures. 731541Srgrimes */ 741541Srgrimes 751541Srgrimesextern int vm_pages_needed; /* should be some "event" structure */ 761541Srgrimessimple_lock_data_t vm_pages_needed_lock; 771549Srgrimesextern int vm_pageout_pages_needed; 781541Srgrimes 791549Srgrimes#define VM_PAGEOUT_ASYNC 0 801549Srgrimes#define VM_PAGEOUT_SYNC 1 811549Srgrimes#define VM_PAGEOUT_FORCE 2 821541Srgrimes 831541Srgrimes/* 841541Srgrimes * Exported routines. 851541Srgrimes */ 861541Srgrimes 871541Srgrimes/* 881541Srgrimes * Signal pageout-daemon and wait for it. 891541Srgrimes */ 901541Srgrimes 911549Srgrimes#define VM_WAIT vm_wait() 921549Srgrimes 931549Srgrimesinline static void vm_wait() { 941549Srgrimes extern struct proc *curproc, *pageproc; 951549Srgrimes int s; 961549Srgrimes s = splhigh(); 971549Srgrimes if (curproc == pageproc) { 981549Srgrimes vm_pageout_pages_needed = 1; 991549Srgrimes tsleep((caddr_t) &vm_pageout_pages_needed, PSWP, "vmwait", 0); 1001549Srgrimes vm_pageout_pages_needed = 0; 1011549Srgrimes } else { 1021549Srgrimes wakeup((caddr_t) &vm_pages_needed); 1031549Srgrimes tsleep((caddr_t) &cnt.v_free_count, PVM, "vmwait", 0); 1041549Srgrimes } 1051549Srgrimes splx(s); 1061549Srgrimes} 1071549Srgrimes 1081549Srgrimes 1091541Srgrimes#ifdef KERNEL 1101541Srgrimesvoid vm_pageout __P((void)); 1111549Srgrimesint vm_pageout_scan __P((void)); 1121541Srgrimesvoid vm_pageout_page __P((vm_page_t, vm_object_t)); 1131541Srgrimesvoid vm_pageout_cluster __P((vm_page_t, vm_object_t)); 1141541Srgrimes#endif 115