Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 May 2017 01:51:50 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r317622 - user/markj/PQ_LAUNDRY_11/sys/vm
Message-ID:  <201705010151.v411poLT084141@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Mon May  1 01:51:50 2017
New Revision: 317622
URL: https://svnweb.freebsd.org/changeset/base/317622

Log:
  MFC r309203 (by alc):
  Disallow recursion on the free page queue mutex.

Modified:
  user/markj/PQ_LAUNDRY_11/sys/vm/vm_page.c
Directory Properties:
  user/markj/PQ_LAUNDRY_11/   (props changed)

Modified: user/markj/PQ_LAUNDRY_11/sys/vm/vm_page.c
==============================================================================
--- user/markj/PQ_LAUNDRY_11/sys/vm/vm_page.c	Mon May  1 01:50:27 2017	(r317621)
+++ user/markj/PQ_LAUNDRY_11/sys/vm/vm_page.c	Mon May  1 01:51:50 2017	(r317622)
@@ -1538,19 +1538,17 @@ vm_page_alloc(vm_object_t object, vm_pin
 	}
 
 	/*
-	 * The page allocation request can came from consumers which already
-	 * hold the free page queue mutex, like vm_page_insert() in
-	 * vm_page_cache().
+	 * Allocate a page if the number of free pages exceeds the minimum
+	 * for the request class.
 	 */
-	mtx_lock_flags(&vm_page_queue_free_mtx, MTX_RECURSE);
+	mtx_lock(&vm_page_queue_free_mtx);
 	if (vm_cnt.v_free_count + vm_cnt.v_cache_count > vm_cnt.v_free_reserved ||
 	    (req_class == VM_ALLOC_SYSTEM &&
 	    vm_cnt.v_free_count + vm_cnt.v_cache_count > vm_cnt.v_interrupt_free_min) ||
 	    (req_class == VM_ALLOC_INTERRUPT &&
 	    vm_cnt.v_free_count + vm_cnt.v_cache_count > 0)) {
 		/*
-		 * Allocate from the free queue if the number of free pages
-		 * exceeds the minimum for the request class.
+		 * Can we allocate the page from a reservation?
 		 */
 #if VM_NRESERVLEVEL > 0
 		if (object == NULL || (object->flags & (OBJ_COLORED |
@@ -1558,6 +1556,9 @@ vm_page_alloc(vm_object_t object, vm_pin
 		    vm_reserv_alloc_page(object, pindex, mpred)) == NULL)
 #endif
 		{
+			/*
+			 * If not, allocate it from the free page queues.
+			 */
 			m = vm_phys_alloc_pages(object != NULL ?
 			    VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0);
 #if VM_NRESERVLEVEL > 0
@@ -1872,7 +1873,7 @@ vm_page_alloc_freelist(int flind, int re
 	/*
 	 * Do not allocate reserved pages unless the req has asked for it.
 	 */
-	mtx_lock_flags(&vm_page_queue_free_mtx, MTX_RECURSE);
+	mtx_lock(&vm_page_queue_free_mtx);
 	if (vm_cnt.v_free_count + vm_cnt.v_cache_count > vm_cnt.v_free_reserved ||
 	    (req_class == VM_ALLOC_SYSTEM &&
 	    vm_cnt.v_free_count + vm_cnt.v_cache_count > vm_cnt.v_interrupt_free_min) ||



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