| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: uvm_pdpolicy_clock.c,v 1.16 2012/01/28 00:00:06 rmind Exp $ */ | | 1 | /* $NetBSD: uvm_pdpolicy_clock.c,v 1.17 2012/01/30 17:21:52 para 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.16 2012/01/28 00:00:06 rmind Exp $"); | | 72 | __KERNEL_RCSID(0, "$NetBSD: uvm_pdpolicy_clock.c,v 1.17 2012/01/30 17:21:52 para 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 | | | 82 | |
83 | #endif /* defined(PDSIM) */ | | 83 | #endif /* defined(PDSIM) */ |
84 | | | 84 | |
85 | #define PQ_INACTIVE PQ_PRIVATE1 /* page is in inactive list */ | | 85 | #define PQ_INACTIVE PQ_PRIVATE1 /* page is in inactive list */ |
| @@ -409,42 +409,28 @@ uvmpdpol_init(void) | | | @@ -409,42 +409,28 @@ uvmpdpol_init(void) |
409 | uvm_pctparam_init(&s->s_anonmax, 80, NULL); | | 409 | uvm_pctparam_init(&s->s_anonmax, 80, NULL); |
410 | uvm_pctparam_init(&s->s_filemax, 50, NULL); | | 410 | uvm_pctparam_init(&s->s_filemax, 50, NULL); |
411 | uvm_pctparam_init(&s->s_execmax, 30, NULL); | | 411 | uvm_pctparam_init(&s->s_execmax, 30, NULL); |
412 | } | | 412 | } |
413 | | | 413 | |
414 | void | | 414 | void |
415 | uvmpdpol_reinit(void) | | 415 | uvmpdpol_reinit(void) |
416 | { | | 416 | { |
417 | } | | 417 | } |
418 | | | 418 | |
419 | bool | | 419 | bool |
420 | uvmpdpol_needsscan_p(void) | | 420 | uvmpdpol_needsscan_p(void) |
421 | { | | 421 | { |
422 | vmem_size_t kva_size, kva_free; | | | |
423 | | | 422 | |
424 | kva_size = vmem_size(kmem_arena, VMEM_FREE | VMEM_ALLOC); | | 423 | return pdpol_state.s_inactive < pdpol_state.s_inactarg; |
425 | kva_free = vmem_size(kmem_arena, VMEM_FREE); | | | |
426 | | | | |
427 | if (kva_free < (kva_size / 10)) { | | | |
428 | return true; | | | |
429 | } | | | |
430 | | | | |
431 | if (pdpol_state.s_inactive < pdpol_state.s_inactarg) { | | | |
432 | return true; | | | |
433 | } | | | |
434 | if (pdpol_state.s_inactive < pdpol_state.s_inactarg) { | | | |
435 | return true; | | | |
436 | } | | | |
437 | return false; | | | |
438 | } | | 424 | } |
439 | | | 425 | |
440 | void | | 426 | void |
441 | uvmpdpol_tune(void) | | 427 | uvmpdpol_tune(void) |
442 | { | | 428 | { |
443 | | | 429 | |
444 | clock_tune(); | | 430 | clock_tune(); |
445 | } | | 431 | } |
446 | | | 432 | |
447 | #if !defined(PDSIM) | | 433 | #if !defined(PDSIM) |
448 | | | 434 | |
449 | #include <sys/sysctl.h> /* XXX SYSCTL_DESCR */ | | 435 | #include <sys/sysctl.h> /* XXX SYSCTL_DESCR */ |
450 | | | 436 | |