summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2017-08-27 01:59:31 +0000
committerBob Beck <beck@cvs.openbsd.org>2017-08-27 01:59:31 +0000
commit521a86ab19d71c15640dd2c7ceb6da4fea84775a (patch)
treef8f7e302ac06ca86827c9a8e665ab4766d5ca639 /sys/kern
parent665353f72c28d1005e1aea933e46a0a45beaed03 (diff)
Revisit 2q queue sizes. Limit the hot queue to 1/20th the cache size up
to a max of 4096 pages. Limit the warm and cold queues to half the cache. This allows us to more effectively notice re-interest in buffers instead of losing it in a large hot queue. Discussed and shown with claudio@ and benno@ at tk217
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/vfs_bio.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index 217455c1f3f..fc8896f1292 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_bio.c,v 1.184 2017/08/22 00:18:56 sf Exp $ */
+/* $OpenBSD: vfs_bio.c,v 1.185 2017/08/27 01:59:30 beck Exp $ */
/* $NetBSD: vfs_bio.c,v 1.44 1996/06/11 11:15:36 pk Exp $ */
/*
@@ -1592,10 +1592,18 @@ chillbufs(struct bufcache *cache, struct bufqueue *queue, int64_t *queuepages)
int64_t limit, pages;
/*
- * The warm and hot queues are allowed to be up to one third each.
+ * We limit the hot queue to be small, with a max of 4096 pages.
+ * We limit the warm queue to half the cache size.
+ *
* We impose a minimum size of 96 to prevent too much "wobbling".
*/
- limit = cache->cachepages / 3;
+ if (queue == &cache->hotqueue)
+ limit = min(cache->cachepages / 20, 4096);
+ else if (queue == &cache->warmqueue)
+ limit = (cache->cachepages / 2);
+ else
+ panic("chillbufs: invalid queue");
+
if (*queuepages > 96 && *queuepages > limit) {
bp = TAILQ_FIRST(queue);
if (!bp)