diff --git a/sys/kern/subr_param.c b/sys/kern/subr_param.c index 517f8233778b..d8f390bbd5a8 100644 --- a/sys/kern/subr_param.c +++ b/sys/kern/subr_param.c @@ -291,10 +291,7 @@ init_param2(long physpages) * Physical buffers are pre-allocated buffers (struct buf) that * are used as temporary holders for I/O, such as paging I/O. */ - nswbuf = min(nbuf / 4, 256); TUNABLE_INT_FETCH("kern.nswbuf", &nswbuf); - if (nswbuf < NSWBUF_MIN) - nswbuf = NSWBUF_MIN; /* * The default for maxpipekva is min(1/64 of the kernel address space, diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 3766c7d8d55f..b44172939c47 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -1124,6 +1124,12 @@ kern_vfs_bio_buffer_alloc(caddr_t v, long physmem_est) nbuf = buf_sz / BKVASIZE; } + if (nswbuf == 0) { + nswbuf = min(nbuf / 4, 256); + if (nswbuf < NSWBUF_MIN) + nswbuf = NSWBUF_MIN; + } + /* * Reserve space for the buffer cache buffers */