aboutsummaryrefslogtreecommitdiff
path: root/sys/vm
diff options
context:
space:
mode:
authorMatthew Dillon <dillon@FreeBSD.org>2000-03-27 21:33:32 +0000
committerMatthew Dillon <dillon@FreeBSD.org>2000-03-27 21:33:32 +0000
commit25db2c5417476bb01a0ec062ebd99fe1b2a636ab (patch)
tree81baffab624adaedac136089566eef2117fab135 /sys/vm
parent7c58e473f593306feb5d6b7c5c3c7461dab53eb3 (diff)
downloadsrc-25db2c5417476bb01a0ec062ebd99fe1b2a636ab.tar.gz
src-25db2c5417476bb01a0ec062ebd99fe1b2a636ab.zip
Add necessary spl protection for swapper. The problem was located by
Alfred while testing his SPLASSERT stuff. This is not a complete fix, more protections are probably needed.
Notes
Notes: svn path=/head/; revision=58708
Diffstat (limited to 'sys/vm')
-rw-r--r--sys/vm/swap_pager.c7
-rw-r--r--sys/vm/vm_pageout.c4
-rw-r--r--sys/vm/vm_pager.h11
3 files changed, 19 insertions, 3 deletions
diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c
index ca7a3fe5b4e5..683eb9d9e15f 100644
--- a/sys/vm/swap_pager.c
+++ b/sys/vm/swap_pager.c
@@ -702,8 +702,6 @@ swap_pager_copy(srcobject, dstobject, offset, destroysource)
* distance. We do not try to restrict it to the swap device stripe
* (that is handled in getpages/putpages). It probably isn't worth
* doing here.
- *
- * This routine must be called at splvm().
*/
boolean_t
@@ -714,14 +712,17 @@ swap_pager_haspage(object, pindex, before, after)
int *after;
{
daddr_t blk0;
+ int s;
/*
* do we have good backing store at the requested index ?
*/
+ s = splvm();
blk0 = swp_pager_meta_ctl(object, pindex, 0);
if (blk0 == SWAPBLK_NONE) {
+ splx(s);
if (before)
*before = 0;
if (after)
@@ -764,7 +765,7 @@ swap_pager_haspage(object, pindex, before, after)
}
*after = (i - 1);
}
-
+ splx(s);
return (TRUE);
}
diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c
index 91bf4ee8475b..592f6cdb6943 100644
--- a/sys/vm/vm_pageout.c
+++ b/sys/vm/vm_pageout.c
@@ -1151,6 +1151,7 @@ vm_pageout_page_stats()
int pcount,tpcount; /* Number of pages to check */
static int fullintervalcount = 0;
int page_shortage;
+ int s0;
page_shortage =
(cnt.v_inactive_target + cnt.v_cache_max + cnt.v_free_min) -
@@ -1159,6 +1160,8 @@ vm_pageout_page_stats()
if (page_shortage <= 0)
return;
+ s0 = splvm();
+
pcount = cnt.v_active_count;
fullintervalcount += vm_pageout_stats_interval;
if (fullintervalcount < vm_pageout_full_stats_interval) {
@@ -1227,6 +1230,7 @@ vm_pageout_page_stats()
m = next;
}
+ splx(s0);
}
static int
diff --git a/sys/vm/vm_pager.h b/sys/vm/vm_pager.h
index c5482315f527..3824c633b623 100644
--- a/sys/vm/vm_pager.h
+++ b/sys/vm/vm_pager.h
@@ -146,6 +146,17 @@ vm_pager_put_pages(
(object, m, count, flags, rtvals);
}
+/*
+ * vm_pager_haspage
+ *
+ * Check to see if an object's pager has the requested page. The
+ * object's pager will also set before and after to give the caller
+ * some idea of the number of pages before and after the requested
+ * page can be I/O'd efficiently.
+ *
+ * This routine does not have to be called at any particular spl.
+ */
+
static __inline boolean_t
vm_pager_has_page(
vm_object_t object,