Mon Dec 30 18:18:03 2019 UTC ()
Whitespace.


(ad)
diff -r1.24 -r1.25 src/sys/uvm/uvm_pdpolicy_clock.c

cvs diff -r1.24 -r1.25 src/sys/uvm/uvm_pdpolicy_clock.c (expand / switch to unified diff)

--- src/sys/uvm/uvm_pdpolicy_clock.c 2019/12/30 18:08:38 1.24
+++ src/sys/uvm/uvm_pdpolicy_clock.c 2019/12/30 18:18:03 1.25
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: uvm_pdpolicy_clock.c,v 1.24 2019/12/30 18:08:38 ad Exp $ */ 1/* $NetBSD: uvm_pdpolicy_clock.c,v 1.25 2019/12/30 18:18:03 ad Exp $ */
2/* NetBSD: uvm_pdaemon.c,v 1.72 2006/01/05 10:47:33 yamt Exp $ */ 2/* NetBSD: uvm_pdaemon.c,v 1.72 2006/01/05 10:47:33 yamt Exp $ */
3 3
4/* 4/*
5 * Copyright (c) 1997 Charles D. Cranor and Washington University. 5 * Copyright (c) 1997 Charles D. Cranor and Washington University.
6 * Copyright (c) 1991, 1993, The Regents of the University of California. 6 * Copyright (c) 1991, 1993, The Regents of the University of California.
7 * 7 *
8 * All rights reserved. 8 * All rights reserved.
9 * 9 *
10 * This code is derived from software contributed to Berkeley by 10 * This code is derived from software contributed to Berkeley by
11 * The Mach Operating System project at Carnegie-Mellon University. 11 * The Mach Operating System project at Carnegie-Mellon University.
12 * 12 *
13 * Redistribution and use in source and binary forms, with or without 13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions 14 * modification, are permitted provided that the following conditions
@@ -59,27 +59,27 @@ @@ -59,27 +59,27 @@
59 * Pittsburgh PA 15213-3890 59 * Pittsburgh PA 15213-3890
60 * 60 *
61 * any improvements or extensions that they make and grant Carnegie the 61 * any improvements or extensions that they make and grant Carnegie the
62 * rights to redistribute these changes. 62 * rights to redistribute these changes.
63 */ 63 */
64 64
65#if defined(PDSIM) 65#if defined(PDSIM)
66 66
67#include "pdsim.h" 67#include "pdsim.h"
68 68
69#else /* defined(PDSIM) */ 69#else /* defined(PDSIM) */
70 70
71#include <sys/cdefs.h> 71#include <sys/cdefs.h>
72__KERNEL_RCSID(0, "$NetBSD: uvm_pdpolicy_clock.c,v 1.24 2019/12/30 18:08:38 ad Exp $"); 72__KERNEL_RCSID(0, "$NetBSD: uvm_pdpolicy_clock.c,v 1.25 2019/12/30 18:18:03 ad Exp $");
73 73
74#include <sys/param.h> 74#include <sys/param.h>
75#include <sys/proc.h> 75#include <sys/proc.h>
76#include <sys/systm.h> 76#include <sys/systm.h>
77#include <sys/kernel.h> 77#include <sys/kernel.h>
78 78
79#include <uvm/uvm.h> 79#include <uvm/uvm.h>
80#include <uvm/uvm_pdpolicy.h> 80#include <uvm/uvm_pdpolicy.h>
81#include <uvm/uvm_pdpolicy_impl.h> 81#include <uvm/uvm_pdpolicy_impl.h>
82#include <uvm/uvm_stat.h> 82#include <uvm/uvm_stat.h>
83 83
84#endif /* defined(PDSIM) */ 84#endif /* defined(PDSIM) */
85 85
@@ -343,27 +343,26 @@ uvmpdpol_balancequeue(int swap_shortage) @@ -343,27 +343,26 @@ uvmpdpol_balancequeue(int swap_shortage)
343 * move on to the next. 343 * move on to the next.
344 */ 344 */
345 mutex_enter(&p->interlock); 345 mutex_enter(&p->interlock);
346 if ((p->uobject == NULL && p->uanon == NULL) || 346 if ((p->uobject == NULL && p->uanon == NULL) ||
347 p->wire_count > 0) { 347 p->wire_count > 0) {
348 mutex_exit(&p->interlock); 348 mutex_exit(&p->interlock);
349 uvmpdpol_pagedequeue_locked(p); 349 uvmpdpol_pagedequeue_locked(p);
350 continue; 350 continue;
351 } 351 }
352 352
353 /* 353 /*
354 * now prepare to move on to the next page. 354 * now prepare to move on to the next page.
355 */ 355 */
356 
357 TAILQ_REMOVE(&pdpol_state.s_activeq, &marker, pdqueue); 356 TAILQ_REMOVE(&pdpol_state.s_activeq, &marker, pdqueue);
358 TAILQ_INSERT_AFTER(&pdpol_state.s_activeq, p, &marker, 357 TAILQ_INSERT_AFTER(&pdpol_state.s_activeq, p, &marker,
359 pdqueue); 358 pdqueue);
360 359
361 /* 360 /*
362 * try to lock the object that owns the page. see comments 361 * try to lock the object that owns the page. see comments
363 * in uvmpdol_selectvictim(). 362 * in uvmpdol_selectvictim().
364 */ 363 */
365 mutex_exit(&s->lock); 364 mutex_exit(&s->lock);
366 lock = uvmpd_trylockowner(p); 365 lock = uvmpd_trylockowner(p);
367 /* p->interlock now released */ 366 /* p->interlock now released */
368 mutex_enter(&s->lock); 367 mutex_enter(&s->lock);
369 if (lock == NULL) { 368 if (lock == NULL) {
@@ -374,27 +373,26 @@ uvmpdpol_balancequeue(int swap_shortage) @@ -374,27 +373,26 @@ uvmpdpol_balancequeue(int swap_shortage)
374 /* 373 /*
375 * if there's a shortage of swap slots, try to free it. 374 * if there's a shortage of swap slots, try to free it.
376 */ 375 */
377 if (swap_shortage > 0 && (p->flags & PG_SWAPBACKED) != 0 && 376 if (swap_shortage > 0 && (p->flags & PG_SWAPBACKED) != 0 &&
378 (p->flags & PG_BUSY) == 0) { 377 (p->flags & PG_BUSY) == 0) {
379 if (uvmpd_dropswap(p)) { 378 if (uvmpd_dropswap(p)) {
380 swap_shortage--; 379 swap_shortage--;
381 } 380 }
382 } 381 }
383 382
384 /* 383 /*
385 * if there's a shortage of inactive pages, deactivate. 384 * if there's a shortage of inactive pages, deactivate.
386 */ 385 */
387 
388 if (inactive_shortage > 0) { 386 if (inactive_shortage > 0) {
389 uvmpdpol_pagedeactivate_locked(p); 387 uvmpdpol_pagedeactivate_locked(p);
390 uvmexp.pddeact++; 388 uvmexp.pddeact++;
391 inactive_shortage--; 389 inactive_shortage--;
392 } 390 }
393 mutex_exit(lock); 391 mutex_exit(lock);
394 } 392 }
395 TAILQ_REMOVE(&pdpol_state.s_activeq, &marker, pdqueue); 393 TAILQ_REMOVE(&pdpol_state.s_activeq, &marker, pdqueue);
396 mutex_exit(&s->lock); 394 mutex_exit(&s->lock);
397} 395}
398 396
399static void 397static void
400uvmpdpol_pagedeactivate_locked(struct vm_page *pg) 398uvmpdpol_pagedeactivate_locked(struct vm_page *pg)