mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-28 11:25:21 +01:00
vm_swapout: Restore handling of RLIMIT_RSS
In commit13a1129d70, I removed the mechanism by which the pagedaemon signals the swapout thread when page reclamation is unable to keep up with demand. This is because the swapout thread's main action in this case is to swap out sleeping processes, but we removed this support. However, it had the secondary effect of causing the swapout thread to enforce RLIMIT_RSS when racct is not enabled. Without it, if racct_enabled is false, nothing ever kicks the swapout thread. Restore the old behaviour of trying to enforce RLIMIT_RSS when the page daemon is unable to keep up with demand. I'm not at all convinced this is a good way to implement the limit, but the change wasn't intentional, so let's restore it for now. Fixes:13a1129d70("vm: Remove kernel stack swapping support, part 1") Reviewed by: olce, kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D56142
This commit is contained in:
1 parent
eaba5142bd
commit
da0764f235
4 files changed
+25
-5
No files matched your search
+1
-1
@@ -5413,7 +5413,7 @@ vm/vm_pager.c standard
|
||||
vm/vm_phys.c standard
|
||||
vm/vm_radix.c standard
|
||||
vm/vm_reserv.c standard
|
||||
vm/vm_swapout.c optional racct
|
||||
vm/vm_swapout.c standard
|
||||
vm/vm_unix.c standard
|
||||
vm/vnode_pager.c standard
|
||||
xen/features.c optional xenhvm
|
||||
|
||||
+7
-1
@@ -1683,7 +1683,7 @@ reinsert:
|
||||
* results to present a coherent view of paging activity on this domain.
|
||||
*/
|
||||
static int
|
||||
vm_pageout_inactive_dispatch(struct vm_domain *vmd, int shortage)
|
||||
vm_pageout_inactive_dispatch(struct vm_domain *vmd, u_int shortage)
|
||||
{
|
||||
u_int freed, pps, slop, threads, us;
|
||||
|
||||
@@ -1796,6 +1796,12 @@ vm_pageout_inactive(struct vm_domain *vmd, int shortage, int *addl_shortage)
|
||||
*/
|
||||
vm_pageout_mightbe_oom(vmd, page_shortage, starting_page_shortage);
|
||||
|
||||
/*
|
||||
* Kick the swapout thread to enforce RSS limits.
|
||||
*/
|
||||
if (page_shortage > 0)
|
||||
vm_swapout_run();
|
||||
|
||||
/*
|
||||
* See the description of addl_page_shortage above.
|
||||
*/
|
||||
|
||||
@@ -103,5 +103,7 @@ void vm_wait_severe(void);
|
||||
int vm_pageout_flush(vm_page_t *mc, int count, int flags, bool *eio);
|
||||
void vm_pageout_oom(int shortage);
|
||||
|
||||
void vm_swapout_run(void);
|
||||
|
||||
#endif /* _KERNEL */
|
||||
#endif /* _VM_VM_PAGEOUT_H_ */
|
||||
+15
-3
@@ -135,6 +135,19 @@ MTX_SYSINIT(vm_daemon, &vm_daemon_mtx, "vm daemon", MTX_DEF);
|
||||
static void vm_swapout_map_deactivate_pages(vm_map_t, long);
|
||||
static void vm_swapout_object_deactivate(pmap_t, vm_object_t, long);
|
||||
|
||||
void
|
||||
vm_swapout_run(void)
|
||||
{
|
||||
static int lastrun = 0;
|
||||
|
||||
mtx_lock(&vm_daemon_mtx);
|
||||
if (ticks - lastrun >= hz || ticks < lastrun) {
|
||||
wakeup(&vm_daemon_needed);
|
||||
lastrun = ticks;
|
||||
}
|
||||
mtx_unlock(&vm_daemon_mtx);
|
||||
}
|
||||
|
||||
static void
|
||||
vm_swapout_object_deactivate_page(pmap_t pmap, vm_page_t m, bool unmap)
|
||||
{
|
||||
@@ -287,15 +300,14 @@ vm_daemon(void)
|
||||
if (racct_enable && vm_daemon_timeout == 0)
|
||||
vm_daemon_timeout = hz;
|
||||
|
||||
while (TRUE) {
|
||||
while (true) {
|
||||
mtx_lock(&vm_daemon_mtx);
|
||||
msleep(&vm_daemon_needed, &vm_daemon_mtx, PPAUSE, "psleep",
|
||||
vm_daemon_timeout);
|
||||
mtx_unlock(&vm_daemon_mtx);
|
||||
|
||||
/*
|
||||
* scan the processes for exceeding their rlimits or if
|
||||
* process is swapped out -- deactivate pages
|
||||
* Scan for processes exceeding their rlimits.
|
||||
*/
|
||||
tryagain = 0;
|
||||
attempts = 0;
|
||||
|
||||
Reference in new issue
Block a user