diff options
author | dillon <dillon@FreeBSD.org> | 2000-03-27 21:33:32 +0000 |
---|---|---|
committer | dillon <dillon@FreeBSD.org> | 2000-03-27 21:33:32 +0000 |
commit | 5ccef75e02afa360480c05b8d01bdd8f2abc39bc (patch) | |
tree | f01da80154cdb9843c291ec59e59ba669f6c6d9a | |
parent | 8fb4c6b599d7fa91e11e38647e849dbac3dabf29 (diff) | |
download | FreeBSD-src-5ccef75e02afa360480c05b8d01bdd8f2abc39bc.zip FreeBSD-src-5ccef75e02afa360480c05b8d01bdd8f2abc39bc.tar.gz |
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.
-rw-r--r-- | sys/vm/swap_pager.c | 7 | ||||
-rw-r--r-- | sys/vm/vm_pageout.c | 4 | ||||
-rw-r--r-- | sys/vm/vm_pager.h | 11 |
3 files changed, 19 insertions, 3 deletions
diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index ca7a3fe..683eb9d 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 91bf4ee..592f6cd 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 c548231..3824c63 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, |