From eddc92918eaca1bd68791a0f25480697ed806a3e Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Wed, 20 Jun 2012 23:25:47 +0000 Subject: [PATCH] Selectively inline vm_page_dirty(). --- sys/vm/vm_page.c | 7 +++++-- sys/vm/vm_page.h | 24 +++++++++++++++++++++++- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index 5b3afe718d41..c1a7e40d2eae 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -783,7 +783,7 @@ vm_page_sleep(vm_page_t m, const char *msg) } /* - * vm_page_dirty: + * vm_page_dirty_KBI: [ internal use only ] * * Set all bits in the page's dirty field. * @@ -791,11 +791,14 @@ vm_page_sleep(vm_page_t m, const char *msg) * call is made from the machine-independent layer. * * See vm_page_clear_dirty_mask(). + * + * This function should only be called by vm_page_dirty(). */ void -vm_page_dirty(vm_page_t m) +vm_page_dirty_KBI(vm_page_t m) { + /* These assertions refer to this operation by its public name. */ KASSERT((m->flags & PG_CACHED) == 0, ("vm_page_dirty: page in cache!")); KASSERT(!VM_PAGE_IS_FREE(m), diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h index 44fe235b2415..d9d1a60eb634 100644 --- a/sys/vm/vm_page.h +++ b/sys/vm/vm_page.h @@ -360,7 +360,6 @@ void vm_page_hold(vm_page_t mem); void vm_page_unhold(vm_page_t mem); void vm_page_free(vm_page_t m); void vm_page_free_zero(vm_page_t m); -void vm_page_dirty(vm_page_t m); void vm_page_wakeup(vm_page_t m); void vm_pageq_remove(vm_page_t m); @@ -414,6 +413,7 @@ void vm_page_cowfault (vm_page_t); int vm_page_cowsetup(vm_page_t); void vm_page_cowclear (vm_page_t); +void vm_page_dirty_KBI(vm_page_t m); void vm_page_lock_KBI(vm_page_t m, const char *file, int line); void vm_page_unlock_KBI(vm_page_t m, const char *file, int line); int vm_page_trylock_KBI(vm_page_t m, const char *file, int line); @@ -428,6 +428,28 @@ void vm_page_object_lock_assert(vm_page_t m); #define VM_PAGE_OBJECT_LOCK_ASSERT(m) (void)0 #endif +/* + * vm_page_dirty: + * + * Set all bits in the page's dirty field. + * + * The object containing the specified page must be locked if the + * call is made from the machine-independent layer. + * + * See vm_page_clear_dirty_mask(). + */ +static __inline void +vm_page_dirty(vm_page_t m) +{ + + /* Use vm_page_dirty_KBI() under INVARIANTS to save memory. */ +#if defined(KLD_MODULE) || defined(INVARIANTS) + vm_page_dirty_KBI(m); +#else + m->dirty = VM_PAGE_BITS_ALL; +#endif +} + /* * vm_page_sleep_if_busy: *