From 521a86ab19d71c15640dd2c7ceb6da4fea84775a Mon Sep 17 00:00:00 2001 From: Bob Beck Date: Sun, 27 Aug 2017 01:59:31 +0000 Subject: 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 --- sys/kern/vfs_bio.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'sys') 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) -- cgit v1.2.3