summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_page.h
diff options
context:
space:
mode:
authordillon <dillon@FreeBSD.org>2001-07-04 16:20:28 +0000
committerdillon <dillon@FreeBSD.org>2001-07-04 16:20:28 +0000
commite028603b7e3e4fb35cdf00aab533f3965f4a13cc (patch)
tree7420cce169451a74c5b87963467a4aeff668ed12 /sys/vm/vm_page.h
parent0b028660051eb7abf4306d34e7fec0e7fde86a28 (diff)
downloadFreeBSD-src-e028603b7e3e4fb35cdf00aab533f3965f4a13cc.zip
FreeBSD-src-e028603b7e3e4fb35cdf00aab533f3965f4a13cc.tar.gz
With Alfred's permission, remove vm_mtx in favor of a fine-grained approach
(this commit is just the first stage). Also add various GIANT_ macros to formalize the removal of Giant, making it easy to test in a more piecemeal fashion. These macros will allow us to test fine-grained locks to a degree before removing Giant, and also after, and to remove Giant in a piecemeal fashion via sysctl's on those subsystems which the authors believe can operate without Giant.
Diffstat (limited to 'sys/vm/vm_page.h')
-rw-r--r--sys/vm/vm_page.h36
1 files changed, 14 insertions, 22 deletions
diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h
index 6bc7266..1050e8e 100644
--- a/sys/vm/vm_page.h
+++ b/sys/vm/vm_page.h
@@ -305,28 +305,23 @@ extern long first_page; /* first physical page number */
(&vm_page_array[atop(pa) - first_page ])
/*
- * For now, a global vm lock
- */
-#define VM_PAGE_MTX(m) (&vm_mtx)
-
-/*
* Functions implemented as macros
*/
static __inline void
vm_page_flag_set(vm_page_t m, unsigned short bits)
{
-
- mtx_assert(VM_PAGE_MTX(m), MA_OWNED);
- m->flags |= bits;
+ GIANT_REQUIRED;
+ atomic_set_short(&(m)->flags, bits);
+ /* m->flags |= bits; */
}
static __inline void
vm_page_flag_clear(vm_page_t m, unsigned short bits)
{
-
- mtx_assert(VM_PAGE_MTX(m), MA_OWNED);
- m->flags &= ~bits;
+ GIANT_REQUIRED;
+ atomic_clear_short(&(m)->flags, bits);
+ /* m->flags &= ~bits; */
}
#if 0
@@ -386,17 +381,15 @@ vm_page_wakeup(vm_page_t m)
static __inline void
vm_page_io_start(vm_page_t m)
{
-
- mtx_assert(VM_PAGE_MTX(m), MA_OWNED);
- m->busy++;
+ GIANT_REQUIRED;
+ atomic_add_char(&(m)->busy, 1);
}
static __inline void
vm_page_io_finish(vm_page_t m)
{
-
- mtx_assert(VM_PAGE_MTX(m), MA_OWNED);
- m->busy--;
+ GIANT_REQUIRED;
+ atomic_subtract_char(&(m)->busy, 1);
if (m->busy == 0)
vm_page_flash(m);
}
@@ -463,16 +456,14 @@ void vm_page_free_toq(vm_page_t m);
static __inline void
vm_page_hold(vm_page_t mem)
{
-
- mtx_assert(VM_PAGE_MTX(m), MA_OWNED);
+ GIANT_REQUIRED;
mem->hold_count++;
}
static __inline void
vm_page_unhold(vm_page_t mem)
{
-
- mtx_assert(VM_PAGE_MTX(m), MA_OWNED);
+ GIANT_REQUIRED;
--mem->hold_count;
KASSERT(mem->hold_count >= 0, ("vm_page_unhold: hold count < 0!!!"));
}
@@ -578,6 +569,7 @@ vm_page_free_zero(m)
static __inline int
vm_page_sleep_busy(vm_page_t m, int also_m_busy, const char *msg)
{
+ GIANT_REQUIRED;
if ((m->flags & PG_BUSY) || (also_m_busy && m->busy)) {
int s = splvm();
if ((m->flags & PG_BUSY) || (also_m_busy && m->busy)) {
@@ -585,7 +577,7 @@ vm_page_sleep_busy(vm_page_t m, int also_m_busy, const char *msg)
* Page is busy. Wait and retry.
*/
vm_page_flag_set(m, PG_WANTED | PG_REFERENCED);
- msleep(m, VM_PAGE_MTX(m), PVM, msg, 0);
+ tsleep(m, PVM, msg, 0);
}
splx(s);
return(TRUE);
OpenPOWER on IntegriCloud