The branch main has been updated by markj:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=e72f7ed43eefaf305c33c232bc2c33d997427f58

commit e72f7ed43eefaf305c33c232bc2c33d997427f58
Author:     Mark Johnston <[email protected]>
AuthorDate: 2023-04-26 14:09:31 +0000
Commit:     Mark Johnston <[email protected]>
CommitDate: 2023-04-26 14:09:31 +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
---
 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 f1089964a041..6ba7054d3866 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -118,7 +118,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;
@@ -1914,6 +1914,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");

Reply via email to