Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Jun 2013 18:19:27 +0000 (UTC)
From:      Attilio Rao <attilio@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r251471 - head/sys/vm
Message-ID:  <201306061819.r56IJRm1048904@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: attilio
Date: Thu Jun  6 18:19:26 2013
New Revision: 251471
URL: http://svnweb.freebsd.org/changeset/base/251471

Log:
  Complete r251452:
  Avoid to busy/unbusy a page in cases where there is no need to drop the
  vm_obj lock, more nominally when the page is full valid after
  vm_page_grab().
  
  Sponsored by:	EMC / Isilon storage division
  Reviewed by:	alc

Modified:
  head/sys/vm/swap_pager.c
  head/sys/vm/vm_glue.c

Modified: head/sys/vm/swap_pager.c
==============================================================================
--- head/sys/vm/swap_pager.c	Thu Jun  6 14:43:19 2013	(r251470)
+++ head/sys/vm/swap_pager.c	Thu Jun  6 18:19:26 2013	(r251471)
@@ -1706,18 +1706,19 @@ swp_pager_force_pagein(vm_object_t objec
 	vm_page_t m;
 
 	vm_object_pip_add(object, 1);
-	m = vm_page_grab(object, pindex, VM_ALLOC_NORMAL|VM_ALLOC_RETRY);
+	m = vm_page_grab(object, pindex, VM_ALLOC_NORMAL | VM_ALLOC_RETRY |
+	    VM_ALLOC_NOBUSY);
 	if (m->valid == VM_PAGE_BITS_ALL) {
 		vm_object_pip_subtract(object, 1);
 		vm_page_dirty(m);
 		vm_page_lock(m);
 		vm_page_activate(m);
 		vm_page_unlock(m);
-		vm_page_wakeup(m);
 		vm_pager_page_unswapped(m);
 		return;
 	}
 
+	vm_page_busy(m);
 	if (swap_pager_getpages(object, &m, 1, 0) != VM_PAGER_OK)
 		panic("swap_pager_force_pagein: read from swap failed");/*XXX*/
 	vm_object_pip_subtract(object, 1);

Modified: head/sys/vm/vm_glue.c
==============================================================================
--- head/sys/vm/vm_glue.c	Thu Jun  6 14:43:19 2013	(r251470)
+++ head/sys/vm/vm_glue.c	Thu Jun  6 18:19:26 2013	(r251471)
@@ -241,8 +241,10 @@ vm_imgact_hold_page(vm_object_t object, 
 
 	VM_OBJECT_WLOCK(object);
 	pindex = OFF_TO_IDX(offset);
-	m = vm_page_grab(object, pindex, VM_ALLOC_NORMAL | VM_ALLOC_RETRY);
+	m = vm_page_grab(object, pindex, VM_ALLOC_NORMAL | VM_ALLOC_RETRY |
+	    VM_ALLOC_NOBUSY);
 	if (m->valid != VM_PAGE_BITS_ALL) {
+		vm_page_busy(m);
 		ma[0] = m;
 		rv = vm_pager_get_pages(object, ma, 1, 0);
 		m = vm_page_lookup(object, pindex);
@@ -255,11 +257,11 @@ vm_imgact_hold_page(vm_object_t object, 
 			m = NULL;
 			goto out;
 		}
+		vm_page_wakeup(m);
 	}
 	vm_page_lock(m);
 	vm_page_hold(m);
 	vm_page_unlock(m);
-	vm_page_wakeup(m);
 out:
 	VM_OBJECT_WUNLOCK(object);
 	return (m);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201306061819.r56IJRm1048904>