vm_pageout.c (223729) | vm_pageout.c (223825) |
---|---|
1/*- 2 * Copyright (c) 1991 Regents of the University of California. 3 * All rights reserved. 4 * Copyright (c) 1994 John S. Dyson 5 * All rights reserved. 6 * Copyright (c) 1994 David Greenman 7 * All rights reserved. 8 * Copyright (c) 2005 Yahoo! Technologies Norway AS --- 59 unchanged lines hidden (view full) --- 68 * rights to redistribute these changes. 69 */ 70 71/* 72 * The proverbial page-out daemon. 73 */ 74 75#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1991 Regents of the University of California. 3 * All rights reserved. 4 * Copyright (c) 1994 John S. Dyson 5 * All rights reserved. 6 * Copyright (c) 1994 David Greenman 7 * All rights reserved. 8 * Copyright (c) 2005 Yahoo! Technologies Norway AS --- 59 unchanged lines hidden (view full) --- 68 * rights to redistribute these changes. 69 */ 70 71/* 72 * The proverbial page-out daemon. 73 */ 74 75#include <sys/cdefs.h> |
76__FBSDID("$FreeBSD: head/sys/vm/vm_pageout.c 223729 2011-07-02 23:34:47Z alc $"); | 76__FBSDID("$FreeBSD: head/sys/vm/vm_pageout.c 223825 2011-07-06 20:06:44Z trasz $"); |
77 78#include "opt_vm.h" 79#include <sys/param.h> 80#include <sys/systm.h> 81#include <sys/kernel.h> 82#include <sys/eventhandler.h> 83#include <sys/lock.h> 84#include <sys/mutex.h> --- 1550 unchanged lines hidden (view full) --- 1635static void 1636vm_daemon() 1637{ 1638 struct rlimit rsslim; 1639 struct proc *p; 1640 struct thread *td; 1641 struct vmspace *vm; 1642 int breakout, swapout_flags, tryagain, attempts; | 77 78#include "opt_vm.h" 79#include <sys/param.h> 80#include <sys/systm.h> 81#include <sys/kernel.h> 82#include <sys/eventhandler.h> 83#include <sys/lock.h> 84#include <sys/mutex.h> --- 1550 unchanged lines hidden (view full) --- 1635static void 1636vm_daemon() 1637{ 1638 struct rlimit rsslim; 1639 struct proc *p; 1640 struct thread *td; 1641 struct vmspace *vm; 1642 int breakout, swapout_flags, tryagain, attempts; |
1643#ifdef RACCT |
|
1643 uint64_t rsize, ravailable; | 1644 uint64_t rsize, ravailable; |
1645#endif |
|
1644 1645 while (TRUE) { 1646 mtx_lock(&vm_daemon_mtx); 1647#ifdef RACCT 1648 msleep(&vm_daemon_needed, &vm_daemon_mtx, PPAUSE, "psleep", hz); 1649#else 1650 msleep(&vm_daemon_needed, &vm_daemon_mtx, PPAUSE, "psleep", 0); 1651#endif --- 65 unchanged lines hidden (view full) --- 1717 if (vm == NULL) 1718 continue; 1719 1720 size = vmspace_resident_count(vm); 1721 if (limit >= 0 && size >= limit) { 1722 vm_pageout_map_deactivate_pages( 1723 &vm->vm_map, limit); 1724 } | 1646 1647 while (TRUE) { 1648 mtx_lock(&vm_daemon_mtx); 1649#ifdef RACCT 1650 msleep(&vm_daemon_needed, &vm_daemon_mtx, PPAUSE, "psleep", hz); 1651#else 1652 msleep(&vm_daemon_needed, &vm_daemon_mtx, PPAUSE, "psleep", 0); 1653#endif --- 65 unchanged lines hidden (view full) --- 1719 if (vm == NULL) 1720 continue; 1721 1722 size = vmspace_resident_count(vm); 1723 if (limit >= 0 && size >= limit) { 1724 vm_pageout_map_deactivate_pages( 1725 &vm->vm_map, limit); 1726 } |
1727#ifdef RACCT |
|
1725 rsize = IDX_TO_OFF(size); 1726 PROC_LOCK(p); 1727 racct_set(p, RACCT_RSS, rsize); 1728 ravailable = racct_get_available(p, RACCT_RSS); 1729 PROC_UNLOCK(p); 1730 if (rsize > ravailable) { 1731 /* 1732 * Don't be overly aggressive; this might be --- 12 unchanged lines hidden (view full) --- 1745 size = vmspace_resident_count(vm); 1746 rsize = IDX_TO_OFF(size); 1747 PROC_LOCK(p); 1748 racct_set(p, RACCT_RSS, rsize); 1749 PROC_UNLOCK(p); 1750 if (rsize > ravailable) 1751 tryagain = 1; 1752 } | 1728 rsize = IDX_TO_OFF(size); 1729 PROC_LOCK(p); 1730 racct_set(p, RACCT_RSS, rsize); 1731 ravailable = racct_get_available(p, RACCT_RSS); 1732 PROC_UNLOCK(p); 1733 if (rsize > ravailable) { 1734 /* 1735 * Don't be overly aggressive; this might be --- 12 unchanged lines hidden (view full) --- 1748 size = vmspace_resident_count(vm); 1749 rsize = IDX_TO_OFF(size); 1750 PROC_LOCK(p); 1751 racct_set(p, RACCT_RSS, rsize); 1752 PROC_UNLOCK(p); 1753 if (rsize > ravailable) 1754 tryagain = 1; 1755 } |
1756#endif |
|
1753 vmspace_free(vm); 1754 } 1755 sx_sunlock(&allproc_lock); 1756 if (tryagain != 0 && attempts <= 10) 1757 goto again; 1758 } 1759} 1760#endif /* !defined(NO_SWAPPING) */ | 1757 vmspace_free(vm); 1758 } 1759 sx_sunlock(&allproc_lock); 1760 if (tryagain != 0 && attempts <= 10) 1761 goto again; 1762 } 1763} 1764#endif /* !defined(NO_SWAPPING) */ |