-/* $OpenBSD: uvm.h,v 1.59 2015/05/04 10:21:15 dlg Exp $ */
+/* $OpenBSD: uvm.h,v 1.60 2015/10/08 15:58:38 kettenis Exp $ */
/* $NetBSD: uvm.h,v 1.24 2000/11/27 08:40:02 chs Exp $ */
/*
struct pglist page_inactive_swp;/* pages inactive (reclaim or free) */
struct pglist page_inactive_obj;/* pages inactive (reclaim or free) */
/* Lock order: pageqlock, then fpageqlock. */
+ struct mutex pageqlock; /* lock for active/inactive page q */
struct mutex fpageqlock; /* lock for free page q + pdaemon */
boolean_t page_init_done; /* TRUE if uvm_page_init() finished */
struct uvm_pmr_control pmr_control; /* pmemrange data */
-/* $OpenBSD: uvm_page.c,v 1.142 2015/09/21 12:59:01 visa Exp $ */
+/* $OpenBSD: uvm_page.c,v 1.143 2015/10/08 15:58:38 kettenis Exp $ */
/* $NetBSD: uvm_page.c,v 1.44 2000/11/27 08:40:04 chs Exp $ */
/*
TAILQ_INIT(&uvm.page_active);
TAILQ_INIT(&uvm.page_inactive_swp);
TAILQ_INIT(&uvm.page_inactive_obj);
+ mtx_init(&uvm.pageqlock, IPL_NONE);
mtx_init(&uvm.fpageqlock, IPL_VM);
uvm_pmr_init();
-/* $OpenBSD: uvm_page.h,v 1.59 2015/08/21 16:04:35 visa Exp $ */
+/* $OpenBSD: uvm_page.h,v 1.60 2015/10/08 15:58:38 kettenis Exp $ */
/* $NetBSD: uvm_page.h,v 1.19 2000/12/28 08:24:55 chs Exp $ */
/*
* macros
*/
-#define uvm_lock_pageq() /* lock */
-#define uvm_unlock_pageq() /* unlock */
+#define uvm_lock_pageq() mtx_enter(&uvm.pageqlock)
+#define uvm_unlock_pageq() mtx_leave(&uvm.pageqlock)
#define uvm_lock_fpageq() mtx_enter(&uvm.fpageqlock)
#define uvm_unlock_fpageq() mtx_leave(&uvm.fpageqlock)
-/* $OpenBSD: uvm_pdaemon.c,v 1.76 2015/08/21 16:04:35 visa Exp $ */
+/* $OpenBSD: uvm_pdaemon.c,v 1.77 2015/10/08 15:58:38 kettenis Exp $ */
/* $NetBSD: uvm_pdaemon.c,v 1.23 2000/08/20 10:24:14 bjh21 Exp $ */
/*
if (uvmexp.free - BUFPAGES_DEFICIT < uvmexp.freetarg)
size += uvmexp.freetarg - (uvmexp.free -
BUFPAGES_DEFICIT);
+ uvm_unlock_pageq();
(void) bufbackoff(&constraint, size * 2);
+ uvm_lock_pageq();
/* Scan if needed to meet our targets. */
if (pma != NULL ||