Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/uvm - make uvm_swap_stats acquire swap_syscall_lock by i...
details: https://anonhg.NetBSD.org/src/rev/8a4e792ab154
branches: trunk
changeset: 584441:8a4e792ab154
user: yamt <yamt%NetBSD.org@localhost>
date: Sat Sep 17 14:51:50 2005 +0000
description:
- make uvm_swap_stats acquire swap_syscall_lock by itsself
so that callers don't need to acquire it beforehand.
- make swap_syscall_lock static.
diffstat:
sys/uvm/uvm_swap.c | 19 +++++++++++++++----
sys/uvm/uvm_swap.h | 4 ++--
2 files changed, 17 insertions(+), 6 deletions(-)
diffs (83 lines):
diff -r 5f09c040e4be -r 8a4e792ab154 sys/uvm/uvm_swap.c
--- a/sys/uvm/uvm_swap.c Sat Sep 17 14:44:09 2005 +0000
+++ b/sys/uvm/uvm_swap.c Sat Sep 17 14:51:50 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_swap.c,v 1.94 2005/06/27 02:29:32 thorpej Exp $ */
+/* $NetBSD: uvm_swap.c,v 1.95 2005/09/17 14:51:50 yamt Exp $ */
/*
* Copyright (c) 1995, 1996, 1997 Matthew R. Green
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.94 2005/06/27 02:29:32 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.95 2005/09/17 14:51:50 yamt Exp $");
#include "fs_nfs.h"
#include "opt_uvmhist.h"
@@ -216,7 +216,7 @@
static struct swap_priority swap_priority;
/* locks */
-struct lock swap_syscall_lock;
+static struct lock swap_syscall_lock;
/*
* prototypes
@@ -231,6 +231,8 @@
static int swap_on(struct proc *, struct swapdev *);
static int swap_off(struct proc *, struct swapdev *);
+static void uvm_swap_stats_locked(int, struct swapent *, int, register_t *);
+
static void sw_reg_strategy(struct swapdev *, struct buf *, int);
static void sw_reg_iodone(struct buf *);
static void sw_reg_start(struct swapdev *);
@@ -487,7 +489,7 @@
len = sizeof(struct swapent) * misc;
sep = (struct swapent *)malloc(len, M_TEMP, M_WAITOK);
- uvm_swap_stats(SCARG(uap, cmd), sep, misc, retval);
+ uvm_swap_stats_locked(SCARG(uap, cmd), sep, misc, retval);
error = copyout(sep, SCARG(uap, arg), len);
free(sep, M_TEMP);
@@ -682,6 +684,15 @@
void
uvm_swap_stats(int cmd, struct swapent *sep, int sec, register_t *retval)
{
+
+ lockmgr(&swap_syscall_lock, LK_EXCLUSIVE, NULL);
+ uvm_swap_stats_locked(cmd, sep, sec, retval);
+ lockmgr(&swap_syscall_lock, LK_RELEASE, NULL);
+}
+
+static void
+uvm_swap_stats_locked(int cmd, struct swapent *sep, int sec, register_t *retval)
+{
struct swappri *spp;
struct swapdev *sdp;
int count = 0;
diff -r 5f09c040e4be -r 8a4e792ab154 sys/uvm/uvm_swap.h
--- a/sys/uvm/uvm_swap.h Sat Sep 17 14:44:09 2005 +0000
+++ b/sys/uvm/uvm_swap.h Sat Sep 17 14:51:50 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_swap.h,v 1.12 2005/09/17 14:38:40 yamt Exp $ */
+/* $NetBSD: uvm_swap.h,v 1.13 2005/09/17 14:51:50 yamt Exp $ */
/*
* Copyright (c) 1997 Matthew R. Green
@@ -48,11 +48,11 @@
int uvm_swap_alloc(int *, boolean_t);
void uvm_swap_free(int, int);
void uvm_swap_markbad(int, int);
-void uvm_swap_stats(int, struct swapent *, int, register_t *);
boolean_t uvm_swapisfull(void);
#else /* defined(VMSWAP) */
#define uvm_swapisfull() TRUE
#endif /* defined(VMSWAP) */
+void uvm_swap_stats(int, struct swapent *, int, register_t *);
#endif /* _KERNEL */
Home |
Main Index |
Thread Index |
Old Index