git: aec3c884057a - stable/13 - buf: Dynamically allocate per-CPU buffer queues
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 11 May 2023 13:33:00 UTC
The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=aec3c884057ab3f95e8c88a346694966df637303 commit aec3c884057ab3f95e8c88a346694966df637303 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2023-05-10 14:05:32 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2023-05-11 13:32:32 +0000 buf: Dynamically allocate per-CPU buffer queues To reduce static bloat. No functional change intended. PR: 269572 Reviewed by: mjg, kib, emaste MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39808 (cherry picked from commit e72f7ed43eefaf305c33c232bc2c33d997427f58) --- sys/kern/vfs_bio.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 174a6e0b556a..cb94dbd81021 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -116,7 +116,7 @@ struct bufqueue { #define BQ_ASSERT_LOCKED(bq) mtx_assert(BQ_LOCKPTR((bq)), MA_OWNED) struct bufdomain { - struct bufqueue bd_subq[MAXCPU + 1]; /* Per-cpu sub queues + global */ + struct bufqueue *bd_subq; struct bufqueue bd_dirtyq; struct bufqueue *bd_cleanq; struct mtx_padalign bd_run_lock; @@ -1901,6 +1901,9 @@ bd_init(struct bufdomain *bd) { int i; + /* Per-CPU clean buf queues, plus one global queue. */ + bd->bd_subq = mallocarray(mp_maxid + 2, sizeof(struct bufqueue), + M_BIOBUF, M_WAITOK | M_ZERO); bd->bd_cleanq = &bd->bd_subq[mp_maxid + 1]; bq_init(bd->bd_cleanq, QUEUE_CLEAN, mp_maxid + 1, "bufq clean lock"); bq_init(&bd->bd_dirtyq, QUEUE_DIRTY, -1, "bufq dirty lock");