read-ahead statistics.
This commit is contained in:
parent
77d152992d
commit
52f0a62851
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: files.uvm,v 1.1 2005/11/27 22:18:41 thorpej Exp $
|
||||
# $NetBSD: files.uvm,v 1.2 2005/11/29 15:45:28 yamt Exp $
|
||||
|
||||
#
|
||||
# UVM options
|
||||
|
@ -6,6 +6,7 @@
|
|||
defflag opt_uvmhist.h UVMHIST UVMHIST_PRINT
|
||||
defflag opt_uvm.h USE_TOPDOWN_VM UVMMAP_NOCOUNTERS
|
||||
defflag opt_vmswap.h VMSWAP
|
||||
defflag opt_readahead.h READAHEAD_STATS
|
||||
|
||||
file uvm/uvm_amap.c
|
||||
file uvm/uvm_anon.c
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: uvm.h,v 1.41 2005/10/30 11:56:51 yamt Exp $ */
|
||||
/* $NetBSD: uvm.h,v 1.42 2005/11/29 15:45:28 yamt Exp $ */
|
||||
|
||||
/*
|
||||
*
|
||||
|
@ -152,6 +152,10 @@ UVMHIST_DECL(ubchist);
|
|||
UVMHIST_DECL(loanhist);
|
||||
#endif
|
||||
|
||||
extern struct evcnt uvm_ra_total;
|
||||
extern struct evcnt uvm_ra_hit;
|
||||
extern struct evcnt uvm_ra_miss;
|
||||
|
||||
/*
|
||||
* UVM_UNLOCK_AND_WAIT: atomic unlock+wait... wrapper around the
|
||||
* interlocked tsleep() function.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: uvm_page.h,v 1.40 2005/06/04 13:48:35 chs Exp $ */
|
||||
/* $NetBSD: uvm_page.h,v 1.41 2005/11/29 15:45:28 yamt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Charles D. Cranor and Washington University.
|
||||
|
@ -169,6 +169,7 @@ struct vm_page {
|
|||
#define PG_FAKE 0x0040 /* page is not yet initialized */
|
||||
#define PG_RDONLY 0x0080 /* page must be mapped read-only */
|
||||
#define PG_ZERO 0x0100 /* page is pre-zero'd */
|
||||
#define PG_SPECULATIVE 0x0200 /* page has been read speculatively */
|
||||
|
||||
#define PG_PAGER1 0x1000 /* pager-specific flag */
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: uvm_pager.c,v 1.71 2005/09/13 22:00:05 yamt Exp $ */
|
||||
/* $NetBSD: uvm_pager.c,v 1.72 2005/11/29 15:45:28 yamt Exp $ */
|
||||
|
||||
/*
|
||||
*
|
||||
|
@ -39,9 +39,10 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: uvm_pager.c,v 1.71 2005/09/13 22:00:05 yamt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: uvm_pager.c,v 1.72 2005/11/29 15:45:28 yamt Exp $");
|
||||
|
||||
#include "opt_uvmhist.h"
|
||||
#include "opt_readahead.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -409,6 +410,10 @@ uvm_aio_aiodone(struct buf *bp)
|
|||
if (pg->flags & PG_FAKE) {
|
||||
KASSERT(!write);
|
||||
pg->flags &= ~PG_FAKE;
|
||||
#if defined(READAHEAD_STATS)
|
||||
pg->flags |= PG_SPECULATIVE;
|
||||
uvm_ra_total.ev_count++;
|
||||
#endif /* defined(READAHEAD_STATS) */
|
||||
uvm_pageactivate(pg);
|
||||
pmap_clear_modify(pg);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: uvm_pdaemon.c,v 1.68 2005/09/13 22:00:05 yamt Exp $ */
|
||||
/* $NetBSD: uvm_pdaemon.c,v 1.69 2005/11/29 15:45:28 yamt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Charles D. Cranor and Washington University.
|
||||
|
@ -71,9 +71,10 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: uvm_pdaemon.c,v 1.68 2005/09/13 22:00:05 yamt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: uvm_pdaemon.c,v 1.69 2005/11/29 15:45:28 yamt Exp $");
|
||||
|
||||
#include "opt_uvmhist.h"
|
||||
#include "opt_readahead.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/proc.h>
|
||||
|
@ -570,6 +571,13 @@ uvmpd_scan_inactive(struct pglist *pglst)
|
|||
* pager to flush and free the page.
|
||||
*/
|
||||
|
||||
#if defined(READAHEAD_STATS)
|
||||
if ((p->flags & PG_SPECULATIVE) != 0) {
|
||||
p->flags &= ~PG_SPECULATIVE;
|
||||
uvm_ra_miss.ev_count++;
|
||||
}
|
||||
#endif /* defined(READAHEAD_STATS) */
|
||||
|
||||
if ((p->pqflags & PQ_SWAPBACKED) == 0) {
|
||||
uvm_unlock_pageq();
|
||||
(void) (uobj->pgops->pgo_put)(uobj, p->offset,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: uvm_stat.c,v 1.28 2005/06/27 02:19:48 thorpej Exp $ */
|
||||
/* $NetBSD: uvm_stat.c,v 1.29 2005/11/29 15:45:28 yamt Exp $ */
|
||||
|
||||
/*
|
||||
*
|
||||
|
@ -39,9 +39,10 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: uvm_stat.c,v 1.28 2005/06/27 02:19:48 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: uvm_stat.c,v 1.29 2005/11/29 15:45:28 yamt Exp $");
|
||||
|
||||
#include "opt_uvmhist.h"
|
||||
#include "opt_readahead.h"
|
||||
#include "opt_ddb.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -247,3 +248,16 @@ uvmexp_print(void (*pr)(const char *, ...))
|
|||
uvmexp.swpages, uvmexp.swpginuse, uvmexp.swpgonly, uvmexp.paging);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(READAHEAD_STATS)
|
||||
|
||||
#define UVM_RA_EVCNT_DEFINE(name) \
|
||||
struct evcnt uvm_ra_##name = \
|
||||
EVCNT_INITIALIZER(EVCNT_TYPE_MISC, NULL, "readahead", #name); \
|
||||
EVCNT_ATTACH_STATIC(uvm_ra_##name);
|
||||
|
||||
UVM_RA_EVCNT_DEFINE(total);
|
||||
UVM_RA_EVCNT_DEFINE(hit);
|
||||
UVM_RA_EVCNT_DEFINE(miss);
|
||||
|
||||
#endif /* defined(READAHEAD_STATS) */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: uvm_vnode.c,v 1.66 2005/06/27 02:29:32 thorpej Exp $ */
|
||||
/* $NetBSD: uvm_vnode.c,v 1.67 2005/11/29 15:45:28 yamt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Charles D. Cranor and Washington University.
|
||||
|
@ -50,10 +50,11 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: uvm_vnode.c,v 1.66 2005/06/27 02:29:32 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: uvm_vnode.c,v 1.67 2005/11/29 15:45:28 yamt Exp $");
|
||||
|
||||
#include "fs_nfs.h"
|
||||
#include "opt_uvmhist.h"
|
||||
#include "opt_readahead.h"
|
||||
#include "opt_ddb.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -294,11 +295,41 @@ uvn_get(struct uvm_object *uobj, voff_t offset,
|
|||
{
|
||||
struct vnode *vp = (struct vnode *)uobj;
|
||||
int error;
|
||||
#if defined(READAHEAD_STATS)
|
||||
int orignpages = *npagesp;
|
||||
#endif /* defined(READAHEAD_STATS) */
|
||||
|
||||
UVMHIST_FUNC("uvn_get"); UVMHIST_CALLED(ubchist);
|
||||
|
||||
UVMHIST_LOG(ubchist, "vp %p off 0x%x", vp, (int)offset, 0,0);
|
||||
error = VOP_GETPAGES(vp, offset, pps, npagesp, centeridx,
|
||||
access_type, advice, flags);
|
||||
|
||||
#if defined(READAHEAD_STATS)
|
||||
if (((flags & PGO_LOCKED) != 0 && *npagesp > 0) ||
|
||||
((flags & (PGO_LOCKED|PGO_SYNCIO)) == PGO_SYNCIO && error == 0)) {
|
||||
int i;
|
||||
|
||||
if ((flags & PGO_LOCKED) == 0) {
|
||||
simple_lock(&uobj->vmobjlock);
|
||||
}
|
||||
for (i = 0; i < orignpages; i++) {
|
||||
struct vm_page *pg = pps[i];
|
||||
|
||||
if (pg == NULL || pg == PGO_DONTCARE) {
|
||||
continue;
|
||||
}
|
||||
if ((pg->flags & PG_SPECULATIVE) != 0) {
|
||||
pg->flags &= ~PG_SPECULATIVE;
|
||||
uvm_ra_hit.ev_count++;
|
||||
}
|
||||
}
|
||||
if ((flags & PGO_LOCKED) == 0) {
|
||||
simple_unlock(&uobj->vmobjlock);
|
||||
}
|
||||
}
|
||||
#endif /* defined(READAHEAD_STATS) */
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue