-.\" $OpenBSD: uvm_init.9,v 1.6 2023/06/20 16:30:30 cheloha Exp $
+.\" $OpenBSD: uvm_init.9,v 1.7 2023/06/21 21:16:21 cheloha Exp $
.\" $NetBSD: uvm.9,v 1.14 2000/06/29 06:08:44 mrg Exp $
.\"
.\" Copyright (c) 1998 Matthew R. Green
.\" XXX this manual sets nS to 1 or 0 in the description, to obtain
.\" synopsis-like function prototypes. any better way?
.\"
-.Dd $Mdocdate: June 20 2023 $
+.Dd $Mdocdate: June 21 2023 $
.Dt UVM_INIT 9
.Os
.Sh NAME
.Ft void
.Fn uvm_kernacc "caddr_t addr" "size_t len" "int rw"
.Ft void
-.Fn uvm_meter "void *"
+.Fn uvm_meter
.Ft int
.Fn uvm_sysctl "int *name" "u_int namelen" "void *oldp" "size_t *oldlenp" "void *newp " "size_t newlen" "struct proc *p"
.Ft int
.Pp
The
.Fn uvm_meter
-function periodically recomputes the load average.
+function calculates the load average and wakes up the swapper if necessary.
.Pp
The
.Fn uvm_sysctl
-/* $OpenBSD: sched_bsd.c,v 1.75 2023/06/20 16:30:30 cheloha Exp $ */
+/* $OpenBSD: sched_bsd.c,v 1.76 2023/06/21 21:16:21 cheloha Exp $ */
/* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */
/*-
}
SCHED_UNLOCK(s);
}
+ uvm_meter();
wakeup(&lbolt);
timeout_add_sec(to, 1);
}
rrticks_init = hz / 10;
schedcpu(&schedcpu_to);
- uvm_meter(NULL);
#ifndef SMALL_KERNEL
if (perfpolicy == PERFPOL_AUTO)
-/* $OpenBSD: uvm_extern.h,v 1.169 2023/06/20 16:30:30 cheloha Exp $ */
+/* $OpenBSD: uvm_extern.h,v 1.170 2023/06/21 21:16:21 cheloha Exp $ */
/* $NetBSD: uvm_extern.h,v 1.57 2001/03/09 01:02:12 chs Exp $ */
/*
struct vmspace *uvmspace_share(struct process *);
int uvm_share(vm_map_t, vaddr_t, vm_prot_t,
vm_map_t, vaddr_t, vsize_t);
-void uvm_meter(void *);
+void uvm_meter(void);
int uvm_sysctl(int *, u_int, void *, size_t *,
void *, size_t, struct proc *);
struct vm_page *uvm_pagealloc(struct uvm_object *,
-/* $OpenBSD: uvm_meter.c,v 1.43 2023/06/20 16:30:30 cheloha Exp $ */
+/* $OpenBSD: uvm_meter.c,v 1.44 2023/06/21 21:16:21 cheloha Exp $ */
/* $NetBSD: uvm_meter.c,v 1.21 2001/07/14 06:36:03 matt Exp $ */
/*
int maxslp = MAXSLP; /* patchable ... */
struct loadavg averunnable;
-#define UVM_METER_INTVL 5
-struct timeout uvm_meter_to = TIMEOUT_INITIALIZER(uvm_meter, NULL);
-
/*
* constants for averages over 1, 5, and 15 minutes when sampling at
* 5 second intervals.
void uvmexp_read(struct uvmexp *);
/*
- * uvm_meter: recompute load averages
+ * uvm_meter: calculate load average and wake up the swapper (if needed)
*/
void
-uvm_meter(void *unused)
+uvm_meter(void)
{
- timeout_add_sec(&uvm_meter_to, UVM_METER_INTVL);
- uvm_loadav(&averunnable);
+ if ((gettime() % 5) == 0)
+ uvm_loadav(&averunnable);
+ if (proc0.p_slptime > (maxslp / 2))
+ wakeup(&proc0);
}
/*