Fri Apr 27 20:41:09 2012 UTC ()
Don't decrement pgrp_active in radioactive page dequeue since we don't
increment it when activated a radioactive page.


(matt)
diff -r1.93.4.2.4.13 -r1.93.4.2.4.14 src/sys/uvm/uvm_pdaemon.c
diff -r1.12.16.7 -r1.12.16.8 src/sys/uvm/uvm_pdpolicy_clock.c

cvs diff -r1.93.4.2.4.13 -r1.93.4.2.4.14 src/sys/uvm/uvm_pdaemon.c (expand / switch to unified diff)

--- src/sys/uvm/uvm_pdaemon.c 2012/04/17 00:19:30 1.93.4.2.4.13
+++ src/sys/uvm/uvm_pdaemon.c 2012/04/27 20:41:09 1.93.4.2.4.14
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: uvm_pdaemon.c,v 1.93.4.2.4.13 2012/04/17 00:19:30 matt Exp $ */ 1/* $NetBSD: uvm_pdaemon.c,v 1.93.4.2.4.14 2012/04/27 20:41:09 matt Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1997 Charles D. Cranor and Washington University. 4 * Copyright (c) 1997 Charles D. Cranor and Washington University.
5 * Copyright (c) 1991, 1993, The Regents of the University of California. 5 * Copyright (c) 1991, 1993, The Regents of the University of California.
6 * 6 *
7 * All rights reserved. 7 * All rights reserved.
8 * 8 *
9 * This code is derived from software contributed to Berkeley by 9 * This code is derived from software contributed to Berkeley by
10 * The Mach Operating System project at Carnegie-Mellon University. 10 * The Mach Operating System project at Carnegie-Mellon University.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions 13 * modification, are permitted provided that the following conditions
14 * are met: 14 * are met:
@@ -61,27 +61,27 @@ @@ -61,27 +61,27 @@
61 * School of Computer Science 61 * School of Computer Science
62 * Carnegie Mellon University 62 * Carnegie Mellon University
63 * Pittsburgh PA 15213-3890 63 * Pittsburgh PA 15213-3890
64 * 64 *
65 * any improvements or extensions that they make and grant Carnegie the 65 * any improvements or extensions that they make and grant Carnegie the
66 * rights to redistribute these changes. 66 * rights to redistribute these changes.
67 */ 67 */
68 68
69/* 69/*
70 * uvm_pdaemon.c: the page daemon 70 * uvm_pdaemon.c: the page daemon
71 */ 71 */
72 72
73#include <sys/cdefs.h> 73#include <sys/cdefs.h>
74__KERNEL_RCSID(0, "$NetBSD: uvm_pdaemon.c,v 1.93.4.2.4.13 2012/04/17 00:19:30 matt Exp $"); 74__KERNEL_RCSID(0, "$NetBSD: uvm_pdaemon.c,v 1.93.4.2.4.14 2012/04/27 20:41:09 matt Exp $");
75 75
76#include "opt_uvmhist.h" 76#include "opt_uvmhist.h"
77#include "opt_readahead.h" 77#include "opt_readahead.h"
78 78
79#include <sys/param.h> 79#include <sys/param.h>
80#include <sys/proc.h> 80#include <sys/proc.h>
81#include <sys/systm.h> 81#include <sys/systm.h>
82#include <sys/kernel.h> 82#include <sys/kernel.h>
83#include <sys/pool.h> 83#include <sys/pool.h>
84#include <sys/buf.h> 84#include <sys/buf.h>
85#include <sys/atomic.h> 85#include <sys/atomic.h>
86 86
87#include <uvm/uvm.h> 87#include <uvm/uvm.h>
@@ -395,27 +395,26 @@ uvm_pageout(void *arg) @@ -395,27 +395,26 @@ uvm_pageout(void *arg)
395 if (progress == false 395 if (progress == false
396 || (pdinfo->pd_waiters == 0 396 || (pdinfo->pd_waiters == 0
397 && TAILQ_FIRST(&pdinfo->pd_pendingq) == NULL)) { 397 && TAILQ_FIRST(&pdinfo->pd_pendingq) == NULL)) {
398 UVMHIST_LOG(pdhist," <<SLEEPING>>",0,0,0,0); 398 UVMHIST_LOG(pdhist," <<SLEEPING>>",0,0,0,0);
399 pdinfo->pd_stalled = !progress 399 pdinfo->pd_stalled = !progress
400 && pdinfo->pd_waiters > 0; 400 && pdinfo->pd_waiters > 0;
401 int timo = (pdinfo->pd_stalled ? 2 * hz : 0); 401 int timo = (pdinfo->pd_stalled ? 2 * hz : 0);
402 UVM_UNLOCK_AND_WAIT(&uvm.pagedaemon, 402 UVM_UNLOCK_AND_WAIT(&uvm.pagedaemon,
403 &uvm_fpageqlock, false, "pgdaemon", timo); 403 &uvm_fpageqlock, false, "pgdaemon", timo);
404 uvmexp.pdwoke++; 404 uvmexp.pdwoke++;
405 UVMHIST_LOG(pdhist," <<WOKE UP>>",0,0,0,0); 405 UVMHIST_LOG(pdhist," <<WOKE UP>>",0,0,0,0);
406 want_tune = pdinfo->pd_stalled; 406 want_tune = pdinfo->pd_stalled;
407 pdinfo->pd_stalled = false; 407 pdinfo->pd_stalled = false;
408 progress = false; 
409 } else if (TAILQ_FIRST(&pdinfo->pd_pendingq) == NULL) { 408 } else if (TAILQ_FIRST(&pdinfo->pd_pendingq) == NULL) {
410 /* 409 /*
411 * Someone is waiting but no group are pending. 410 * Someone is waiting but no group are pending.
412 * Let's kick ourselves to find groups that need work. 411 * Let's kick ourselves to find groups that need work.
413 */ 412 */
414 uvm_kick_pdaemon(); 413 uvm_kick_pdaemon();
415 mutex_spin_exit(&uvm_fpageqlock); 414 mutex_spin_exit(&uvm_fpageqlock);
416 } else { 415 } else {
417 mutex_spin_exit(&uvm_fpageqlock); 416 mutex_spin_exit(&uvm_fpageqlock);
418 } 417 }
419 418
420 /* 419 /*
421 * now lock page queues and recompute inactive count 420 * now lock page queues and recompute inactive count
@@ -430,26 +429,27 @@ uvm_pageout(void *arg) @@ -430,26 +429,27 @@ uvm_pageout(void *arg)
430 || want_tune) { 429 || want_tune) {
431 npages = uvmexp.npages; 430 npages = uvmexp.npages;
432 extrapages = uvm_extrapages; 431 extrapages = uvm_extrapages;
433 npggroups = uvmexp.npggroups; 432 npggroups = uvmexp.npggroups;
434 uvmpd_tune(); 433 uvmpd_tune();
435 want_tune = false; 434 want_tune = false;
436 } 435 }
437 436
438 /* 437 /*
439 * Estimate a hint. Note that bufmem are returned to 438 * Estimate a hint. Note that bufmem are returned to
440 * system only when entire pool page is empty. 439 * system only when entire pool page is empty.
441 */ 440 */
442 bool need_wakeup = false; 441 bool need_wakeup = false;
 442 progress = false;
443 while ((grp = TAILQ_FIRST(&pdinfo->pd_pendingq)) != NULL) { 443 while ((grp = TAILQ_FIRST(&pdinfo->pd_pendingq)) != NULL) {
444 KASSERT(grp->pgrp_npages > 0); 444 KASSERT(grp->pgrp_npages > 0);
445 445
446 uvmpdpol_tune(grp); 446 uvmpdpol_tune(grp);
447 447
448 /* 448 /*
449 * While we are locked, remove this from the pendingq. 449 * While we are locked, remove this from the pendingq.
450 */ 450 */
451 uvmpd_checkgroup(grp); 451 uvmpd_checkgroup(grp);
452 KASSERT(grp->pgrp_scan_needed); 452 KASSERT(grp->pgrp_scan_needed);
453 TAILQ_REMOVE(&pdinfo->pd_pendingq, grp, 453 TAILQ_REMOVE(&pdinfo->pd_pendingq, grp,
454 pgrp_pending_link); 454 pgrp_pending_link);
455 grp->pgrp_scan_needed = false; 455 grp->pgrp_scan_needed = false;

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

--- src/sys/uvm/uvm_pdpolicy_clock.c 2012/04/17 00:12:21 1.12.16.7
+++ src/sys/uvm/uvm_pdpolicy_clock.c 2012/04/27 20:41:09 1.12.16.8
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: uvm_pdpolicy_clock.c,v 1.12.16.7 2012/04/17 00:12:21 matt Exp $ */ 1/* $NetBSD: uvm_pdpolicy_clock.c,v 1.12.16.8 2012/04/27 20:41:09 matt 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
@@ -64,27 +64,27 @@ @@ -64,27 +64,27 @@
64 * Pittsburgh PA 15213-3890 64 * Pittsburgh PA 15213-3890
65 * 65 *
66 * any improvements or extensions that they make and grant Carnegie the 66 * any improvements or extensions that they make and grant Carnegie the
67 * rights to redistribute these changes. 67 * rights to redistribute these changes.
68 */ 68 */
69 69
70#if defined(PDSIM) 70#if defined(PDSIM)
71 71
72#include "pdsim.h" 72#include "pdsim.h"
73 73
74#else /* defined(PDSIM) */ 74#else /* defined(PDSIM) */
75 75
76#include <sys/cdefs.h> 76#include <sys/cdefs.h>
77__KERNEL_RCSID(0, "$NetBSD: uvm_pdpolicy_clock.c,v 1.12.16.7 2012/04/17 00:12:21 matt Exp $"); 77__KERNEL_RCSID(0, "$NetBSD: uvm_pdpolicy_clock.c,v 1.12.16.8 2012/04/27 20:41:09 matt Exp $");
78 78
79#include <sys/param.h> 79#include <sys/param.h>
80#include <sys/proc.h> 80#include <sys/proc.h>
81#include <sys/systm.h> 81#include <sys/systm.h>
82#include <sys/kernel.h> 82#include <sys/kernel.h>
83 83
84#include <uvm/uvm.h> 84#include <uvm/uvm.h>
85#include <uvm/uvm_pdpolicy.h> 85#include <uvm/uvm_pdpolicy.h>
86#include <uvm/uvm_pdpolicy_impl.h> 86#include <uvm/uvm_pdpolicy_impl.h>
87 87
88#endif /* defined(PDSIM) */ 88#endif /* defined(PDSIM) */
89 89
90#define PQ_INACTIVE PQ_PRIVATE1 /* page is in inactive list */ 90#define PQ_INACTIVE PQ_PRIVATE1 /* page is in inactive list */
@@ -424,27 +424,26 @@ uvmpdpol_pagedequeue(struct vm_page *pg) @@ -424,27 +424,26 @@ uvmpdpol_pagedequeue(struct vm_page *pg)
424{ 424{
425 struct uvm_pggroup * const grp = uvm_page_to_pggroup(pg); 425 struct uvm_pggroup * const grp = uvm_page_to_pggroup(pg);
426 struct uvmpdpol_groupstate * const gs = grp->pgrp_gs; 426 struct uvmpdpol_groupstate * const gs = grp->pgrp_gs;
427 427
428 KASSERT(!(pg->pqflags & PQ_FREE)); 428 KASSERT(!(pg->pqflags & PQ_FREE));
429 KASSERT(mutex_owned(&uvm_pageqlock)); 429 KASSERT(mutex_owned(&uvm_pageqlock));
430 //KDASSERT(gs->gs_radioactive == clock_pglist_count(&gs->gs_radioactiveq)); 430 //KDASSERT(gs->gs_radioactive == clock_pglist_count(&gs->gs_radioactiveq));
431 431
432 if (pg->pqflags & PQ_RADIOACTIVE) { 432 if (pg->pqflags & PQ_RADIOACTIVE) {
433 TAILQ_REMOVE(&gs->gs_radioactiveq, pg, pageq.queue); 433 TAILQ_REMOVE(&gs->gs_radioactiveq, pg, pageq.queue);
434 pg->pqflags &= ~PQ_RADIOACTIVE; 434 pg->pqflags &= ~PQ_RADIOACTIVE;
435 KASSERT(gs->gs_radioactive > 0); 435 KASSERT(gs->gs_radioactive > 0);
436 gs->gs_radioactive--; 436 gs->gs_radioactive--;
437 grp->pgrp_active--; 
438 } 437 }
439 438
440 //KDASSERT(gs->gs_radioactive == clock_pglist_count(&gs->gs_radioactiveq)); 439 //KDASSERT(gs->gs_radioactive == clock_pglist_count(&gs->gs_radioactiveq));
441 //KDASSERT(gs->gs_active == clock_pglist_count(&gs->gs_activeq)); 440 //KDASSERT(gs->gs_active == clock_pglist_count(&gs->gs_activeq));
442 441
443 if (pg->pqflags & PQ_ACTIVE) { 442 if (pg->pqflags & PQ_ACTIVE) {
444 TAILQ_REMOVE(&gs->gs_activeq, pg, pageq.queue); 443 TAILQ_REMOVE(&gs->gs_activeq, pg, pageq.queue);
445 pg->pqflags &= ~PQ_ACTIVE; 444 pg->pqflags &= ~PQ_ACTIVE;
446 KASSERT(gs->gs_active > 0); 445 KASSERT(gs->gs_active > 0);
447 gs->gs_active--; 446 gs->gs_active--;
448 grp->pgrp_active--; 447 grp->pgrp_active--;
449 } 448 }
450 449