diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -461,6 +461,7 @@ vmd->vmd_free_count = 0; vmd->vmd_segs = 0; vmd->vmd_oom = false; + vmd->vmd_helper_threads_enabled = true; for (i = 0; i < PQ_COUNT; i++) { pq = &vmd->vmd_pagequeues[i]; TAILQ_INIT(&pq->pq_pl); diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c --- a/sys/vm/vm_pageout.c +++ b/sys/vm/vm_pageout.c @@ -1644,8 +1644,9 @@ * If we have more work than we can do in a quarter of our interval, we * fire off multiple threads to process it. */ - threads = vmd->vmd_inactive_threads; - if (threads > 1 && vmd->vmd_inactive_pps != 0 && + if ((threads = vmd->vmd_inactive_threads) > 1 && + vmd->vmd_helper_threads_enabled && + vmd->vmd_inactive_pps != 0 && shortage > vmd->vmd_inactive_pps / VM_INACT_SCAN_RATE / 4) { vmd->vmd_inactive_shortage /= threads; slop = shortage % threads; @@ -2269,6 +2270,10 @@ pidctrl_init_sysctl(&vmd->vmd_pid, SYSCTL_CHILDREN(oid)); vmd->vmd_inactive_threads = get_pageout_threads_per_domain(vmd); + SYSCTL_ADD_BOOL(NULL, SYSCTL_CHILDREN(vmd->vmd_oid), OID_AUTO, + "pageout_helper_threads_enabled", CTLFLAG_RWTUN, + &vmd->vmd_helper_threads_enabled, 0, + "Enable multi-threaded inactive queue scanning"); } static void diff --git a/sys/vm/vm_pagequeue.h b/sys/vm/vm_pagequeue.h --- a/sys/vm/vm_pagequeue.h +++ b/sys/vm/vm_pagequeue.h @@ -257,8 +257,9 @@ /* Paging control variables, used within single threaded page daemon. */ struct pidctrl vmd_pid; /* Pageout controller. */ - bool vmd_oom; - u_int vmd_inactive_threads; + bool vmd_oom; /* An OOM kill was requested. */ + bool vmd_helper_threads_enabled;/* Use multiple threads to scan. */ + u_int vmd_inactive_threads; /* Number of extra helper threads. */ u_int vmd_inactive_shortage; /* Per-thread shortage. */ blockcount_t vmd_inactive_running; /* Number of inactive threads. */ blockcount_t vmd_inactive_starting; /* Number of threads started. */