vm_glue.c (9468) | vm_glue.c (9507) |
---|---|
1/* 2 * Copyright (c) 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * The Mach Operating System project at Carnegie-Mellon University. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 45 unchanged lines hidden (view full) --- 54 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 55 * School of Computer Science 56 * Carnegie Mellon University 57 * Pittsburgh PA 15213-3890 58 * 59 * any improvements or extensions that they make and grant Carnegie the 60 * rights to redistribute these changes. 61 * | 1/* 2 * Copyright (c) 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * The Mach Operating System project at Carnegie-Mellon University. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 45 unchanged lines hidden (view full) --- 54 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 55 * School of Computer Science 56 * Carnegie Mellon University 57 * Pittsburgh PA 15213-3890 58 * 59 * any improvements or extensions that they make and grant Carnegie the 60 * rights to redistribute these changes. 61 * |
62 * $Id: vm_glue.c,v 1.21 1995/07/10 08:48:58 davidg Exp $ | 62 * $Id: vm_glue.c,v 1.22 1995/07/10 08:53:20 davidg Exp $ |
63 */ 64 65#include <sys/param.h> 66#include <sys/systm.h> 67#include <sys/proc.h> 68#include <sys/resourcevar.h> 69#include <sys/buf.h> 70#include <sys/shm.h> --- 276 unchanged lines hidden (view full) --- 347 register struct proc *p; 348 register int pri; 349 struct proc *pp; 350 int ppri; 351 352loop: 353 while ((cnt.v_free_count + cnt.v_cache_count) < (cnt.v_free_reserved + UPAGES + 2)) { 354 VM_WAIT; | 63 */ 64 65#include <sys/param.h> 66#include <sys/systm.h> 67#include <sys/proc.h> 68#include <sys/resourcevar.h> 69#include <sys/buf.h> 70#include <sys/shm.h> --- 276 unchanged lines hidden (view full) --- 347 register struct proc *p; 348 register int pri; 349 struct proc *pp; 350 int ppri; 351 352loop: 353 while ((cnt.v_free_count + cnt.v_cache_count) < (cnt.v_free_reserved + UPAGES + 2)) { 354 VM_WAIT; |
355 tsleep((caddr_t) &proc0, PVM, "schedm", 0); | 355 tsleep(&proc0, PVM, "schedm", 0); |
356 } 357 358 pp = NULL; 359 ppri = INT_MIN; 360 for (p = (struct proc *) allproc; p != NULL; p = p->p_next) { 361 if (p->p_stat == SRUN && (p->p_flag & (P_INMEM | P_SWAPPING)) == 0) { 362 int mempri; 363 --- 10 unchanged lines hidden (view full) --- 374 } 375 } 376 } 377 378 /* 379 * Nothing to do, back to sleep 380 */ 381 if ((p = pp) == NULL) { | 356 } 357 358 pp = NULL; 359 ppri = INT_MIN; 360 for (p = (struct proc *) allproc; p != NULL; p = p->p_next) { 361 if (p->p_stat == SRUN && (p->p_flag & (P_INMEM | P_SWAPPING)) == 0) { 362 int mempri; 363 --- 10 unchanged lines hidden (view full) --- 374 } 375 } 376 } 377 378 /* 379 * Nothing to do, back to sleep 380 */ 381 if ((p = pp) == NULL) { |
382 tsleep((caddr_t) &proc0, PVM, "sched", 0); | 382 tsleep(&proc0, PVM, "sched", 0); |
383 goto loop; 384 } 385 /* 386 * We would like to bring someone in. (only if there is space). 387 */ 388 faultin(p); 389 p->p_swtime = 0; 390 goto loop; --- 69 unchanged lines hidden (view full) --- 460 vm_map_deallocate(&p->p_vmspace->vm_map); 461 } 462 } 463 /* 464 * If we swapped something out, and another process needed memory, 465 * then wakeup the sched process. 466 */ 467 if (didswap) | 383 goto loop; 384 } 385 /* 386 * We would like to bring someone in. (only if there is space). 387 */ 388 faultin(p); 389 p->p_swtime = 0; 390 goto loop; --- 69 unchanged lines hidden (view full) --- 460 vm_map_deallocate(&p->p_vmspace->vm_map); 461 } 462 } 463 /* 464 * If we swapped something out, and another process needed memory, 465 * then wakeup the sched process. 466 */ 467 if (didswap) |
468 wakeup((caddr_t) &proc0); | 468 wakeup(&proc0); |
469} 470 471void 472swapout(p) 473 register struct proc *p; 474{ 475 vm_map_t map = &p->p_vmspace->vm_map; 476 vm_offset_t ptaddr; --- 23 unchanged lines hidden (view full) --- 500 501 ptaddr = trunc_page((u_int) vtopte(kstack)); 502 vm_map_pageable(map, ptaddr, ptaddr + NBPG, TRUE); 503 504 p->p_flag &= ~P_SWAPPING; 505 p->p_swtime = 0; 506} 507 | 469} 470 471void 472swapout(p) 473 register struct proc *p; 474{ 475 vm_map_t map = &p->p_vmspace->vm_map; 476 vm_offset_t ptaddr; --- 23 unchanged lines hidden (view full) --- 500 501 ptaddr = trunc_page((u_int) vtopte(kstack)); 502 vm_map_pageable(map, ptaddr, ptaddr + NBPG, TRUE); 503 504 p->p_flag &= ~P_SWAPPING; 505 p->p_swtime = 0; 506} 507 |
508/* 509 * The rest of these routines fake thread handling 510 */ 511 512#ifndef assert_wait 513void 514assert_wait(event, ruptible) 515 int event; 516 boolean_t ruptible; 517{ 518#ifdef lint 519 ruptible++; 520#endif 521 curproc->p_thread = event; 522} 523#endif 524 525void 526thread_block(char *msg) 527{ 528 if (curproc->p_thread) 529 tsleep((caddr_t) curproc->p_thread, PVM, msg, 0); 530} 531 532 533void 534thread_sleep_(event, lock, wmesg) 535 int event; 536 simple_lock_t lock; 537 char *wmesg; 538{ 539 540 curproc->p_thread = event; 541 simple_unlock(lock); 542 if (curproc->p_thread) { 543 tsleep((caddr_t) event, PVM, wmesg, 0); 544 } 545} 546 547#ifndef thread_wakeup 548void 549thread_wakeup(event) 550 int event; 551{ 552 wakeup((caddr_t) event); 553} 554#endif 555 | |
556#ifdef DDB | 508#ifdef DDB |
557 | |
558/* 559 * DEBUG stuff 560 */ 561 562int indent; 563 564#include <machine/stdarg.h> /* see subr_prf.c */ 565 --- 23 unchanged lines hidden --- | 509/* 510 * DEBUG stuff 511 */ 512 513int indent; 514 515#include <machine/stdarg.h> /* see subr_prf.c */ 516 --- 23 unchanged lines hidden --- |