ensure the buffer cache backs off all the way with the correct type
authorbeck <beck@openbsd.org>
Tue, 18 Apr 2017 13:41:32 +0000 (13:41 +0000)
committerbeck <beck@openbsd.org>
Tue, 18 Apr 2017 13:41:32 +0000 (13:41 +0000)
of memory, handling the fact that both queues are actually in dma
space when not flipping buffers high

sys/kern/vfs_bio.c

index 30d9c5e..95bc80b 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: vfs_bio.c,v 1.181 2017/04/16 14:25:42 beck Exp $      */
+/*     $OpenBSD: vfs_bio.c,v 1.182 2017/04/18 13:41:32 beck Exp $      */
 /*     $NetBSD: vfs_bio.c,v 1.44 1996/06/11 11:15:36 pk Exp $  */
 
 /*
@@ -1507,13 +1507,17 @@ bufcache_getcleanbuf_range(int start, int end, int discard)
 struct buf *
 bufcache_gethighcleanbuf(void)
 {
-       return bufcache_getcleanbuf_range(DMA_CACHE + 1, NUM_CACHES -1, 0);
+       if (!fliphigh)
+               return NULL;
+       return bufcache_getcleanbuf_range(DMA_CACHE + 1, NUM_CACHES - 1, 0);
 }
 
 struct buf *
 bufcache_getdmacleanbuf(void)
 {
-       return bufcache_getcleanbuf_range(DMA_CACHE, DMA_CACHE, 0);
+       if (fliphigh)
+               return bufcache_getcleanbuf_range(DMA_CACHE, DMA_CACHE, 0);
+       return bufcache_getcleanbuf_range(DMA_CACHE, NUM_CACHES - 1, 0);
 }
 
 struct buf *