Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys remove the aiodoned thread. I originally added this to ...



details:   https://anonhg.NetBSD.org/src/rev/6efc026ea03a
branches:  trunk
changeset: 744941:6efc026ea03a
user:      chs <chs%NetBSD.org@localhost>
date:      Tue Feb 18 20:23:17 2020 +0000

description:
remove the aiodoned thread.  I originally added this to provide a thread context
for doing page cache iodone work, but since then biodone() has changed to
hand off all iodone work to a softint thread, so we no longer need the
special-purpose aiodoned thread.

diffstat:

 sys/kern/init_main.c              |   9 +-----
 sys/miscfs/genfs/genfs_io.c       |  15 +++-------
 sys/rump/librump/rumpkern/rump.c  |  20 +-------------
 sys/rump/librump/rumpvfs/vm_vfs.c |  11 +------
 sys/ufs/lfs/lfs_bio.c             |   6 ++--
 sys/ufs/lfs/lfs_extern.h          |   4 +-
 sys/ufs/lfs/lfs_inode.h           |   4 +-
 sys/ufs/lfs/lfs_segment.c         |  51 +++-----------------------------------
 sys/ufs/lfs/lfs_syscalls.c        |   6 ++--
 sys/ufs/lfs/lfs_vfsops.c          |   6 ++--
 sys/uvm/uvm.h                     |   8 +-----
 sys/uvm/uvm_extern.h              |   3 +-
 sys/uvm/uvm_pager.c               |  24 +----------------
 sys/uvm/uvm_pdaemon.c             |  23 +----------------
 sys/uvm/uvm_swap.c                |  11 ++------
 15 files changed, 38 insertions(+), 163 deletions(-)

diffs (truncated from 569 to 300 lines):

diff -r 9022e57e2a2c -r 6efc026ea03a sys/kern/init_main.c
--- a/sys/kern/init_main.c      Tue Feb 18 17:50:32 2020 +0000
+++ b/sys/kern/init_main.c      Tue Feb 18 20:23:17 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: init_main.c,v 1.520 2020/02/15 18:12:15 ad Exp $       */
+/*     $NetBSD: init_main.c,v 1.521 2020/02/18 20:23:17 chs Exp $      */
 
 /*-
  * Copyright (c) 2008, 2009, 2019 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.520 2020/02/15 18:12:15 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.521 2020/02/18 20:23:17 chs Exp $");
 
 #include "opt_ddb.h"
 #include "opt_inet.h"
@@ -720,11 +720,6 @@
            NULL, NULL, "ioflush"))
                panic("fork syncer");
 
-       /* Create the aiodone daemon kernel thread. */
-       if (workqueue_create(&uvm.aiodone_queue, "aiodoned",
-           uvm_aiodone_worker, NULL, PRI_VM, IPL_NONE, WQ_MPSAFE))
-               panic("fork aiodoned");
-
        /* Wait for final configure threads to complete. */
        config_finalize_mountroot();
 
diff -r 9022e57e2a2c -r 6efc026ea03a sys/miscfs/genfs/genfs_io.c
--- a/sys/miscfs/genfs/genfs_io.c       Tue Feb 18 17:50:32 2020 +0000
+++ b/sys/miscfs/genfs/genfs_io.c       Tue Feb 18 20:23:17 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: genfs_io.c,v 1.84 2020/01/15 17:55:44 ad Exp $ */
+/*     $NetBSD: genfs_io.c,v 1.85 2020/02/18 20:23:17 chs Exp $        */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.84 2020/01/15 17:55:44 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.85 2020/02/18 20:23:17 chs Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -606,9 +606,6 @@
        if (kva == 0)
                return EBUSY;
 
-       if (uvm.aiodone_queue == NULL)
-               async = 0;
-
        mbp = getiobuf(vp, true);
        mbp->b_bufsize = totalbytes;
        mbp->b_data = (void *)kva;
@@ -616,7 +613,7 @@
        mbp->b_cflags = BC_BUSY;
        if (async) {
                mbp->b_flags = B_READ | B_ASYNC;
-               mbp->b_iodone = uvm_aio_biodone;
+               mbp->b_iodone = uvm_aio_aiodone;
        } else {
                mbp->b_flags = B_READ;
                mbp->b_iodone = NULL;
@@ -1396,9 +1393,8 @@
            UVMPAGER_MAPIN_WRITE | UVMPAGER_MAPIN_WAITOK);
        len = npages << PAGE_SHIFT;
 
-       KASSERT(uvm.aiodone_queue != NULL);
        error = genfs_do_io(vp, off, kva, len, flags, UIO_WRITE,
-                           uvm_aio_biodone);
+                           uvm_aio_aiodone);
 
        return error;
 }
@@ -1429,9 +1425,8 @@
            UVMPAGER_MAPIN_READ | UVMPAGER_MAPIN_WAITOK);
        len = npages << PAGE_SHIFT;
 
-       KASSERT(uvm.aiodone_queue != NULL);
        error = genfs_do_io(vp, off, kva, len, flags, UIO_WRITE,
-                           uvm_aio_biodone);
+                           uvm_aio_aiodone);
 
        return error;
 }
diff -r 9022e57e2a2c -r 6efc026ea03a sys/rump/librump/rumpkern/rump.c
--- a/sys/rump/librump/rumpkern/rump.c  Tue Feb 18 17:50:32 2020 +0000
+++ b/sys/rump/librump/rumpkern/rump.c  Tue Feb 18 20:23:17 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rump.c,v 1.340 2020/02/10 03:23:29 riastradh Exp $     */
+/*     $NetBSD: rump.c,v 1.341 2020/02/18 20:23:17 chs Exp $   */
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.340 2020/02/10 03:23:29 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.341 2020/02/18 20:23:17 chs Exp $");
 
 #include <sys/systm.h>
 #define ELFSIZE ARCH_ELFSIZE
@@ -116,15 +116,6 @@
 
 pool_cache_t pnbuf_cache;
 
-static void
-rump_aiodone_worker(struct work *wk, void *dummy)
-{
-       struct buf *bp = (struct buf *)wk;
-
-       KASSERT(&bp->b_work == wk);
-       bp->b_iodone(bp);
-}
-
 static int rump_inited;
 
 void (*rump_vfs_drainbufs)(int) = (void *)nullop;
@@ -460,13 +451,6 @@
 
        cold = 0;
 
-       /* aieeeedondest */
-       if (rump_threads) {
-               if (workqueue_create(&uvm.aiodone_queue, "aiodoned",
-                   rump_aiodone_worker, NULL, 0, 0, WQ_MPSAFE))
-                       panic("aiodoned");
-       }
-
        sysctl_finalize();
 
        module_init_class(MODULE_CLASS_ANY);
diff -r 9022e57e2a2c -r 6efc026ea03a sys/rump/librump/rumpvfs/vm_vfs.c
--- a/sys/rump/librump/rumpvfs/vm_vfs.c Tue Feb 18 17:50:32 2020 +0000
+++ b/sys/rump/librump/rumpvfs/vm_vfs.c Tue Feb 18 20:23:17 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vm_vfs.c,v 1.36 2020/01/15 17:55:44 ad Exp $   */
+/*     $NetBSD: vm_vfs.c,v 1.37 2020/02/18 20:23:17 chs Exp $  */
 
 /*
  * Copyright (c) 2008-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vm_vfs.c,v 1.36 2020/01/15 17:55:44 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_vfs.c,v 1.37 2020/02/18 20:23:17 chs Exp $");
 
 #include <sys/param.h>
 
@@ -90,13 +90,6 @@
        kmem_free(pgs, npages * sizeof(*pgs));
 }
 
-void
-uvm_aio_biodone(struct buf *bp)
-{
-
-       uvm_aio_aiodone(bp);
-}
-
 /*
  * UBC
  */
diff -r 9022e57e2a2c -r 6efc026ea03a sys/ufs/lfs/lfs_bio.c
--- a/sys/ufs/lfs/lfs_bio.c     Tue Feb 18 17:50:32 2020 +0000
+++ b/sys/ufs/lfs/lfs_bio.c     Tue Feb 18 20:23:17 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_bio.c,v 1.144 2019/12/31 13:07:14 ad Exp $ */
+/*     $NetBSD: lfs_bio.c,v 1.145 2020/02/18 20:23:17 chs Exp $        */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003, 2008 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_bio.c,v 1.144 2019/12/31 13:07:14 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_bio.c,v 1.145 2020/02/18 20:23:17 chs Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -729,7 +729,7 @@
        bp->b_blkno = daddr;
        bp->b_error = 0;
        bp->b_resid = 0;
-       bp->b_iodone = lfs_callback;
+       bp->b_iodone = lfs_free_aiodone;
        bp->b_cflags = BC_BUSY | BC_NOCACHE;
        bp->b_private = fs;
 
diff -r 9022e57e2a2c -r 6efc026ea03a sys/ufs/lfs/lfs_extern.h
--- a/sys/ufs/lfs/lfs_extern.h  Tue Feb 18 17:50:32 2020 +0000
+++ b/sys/ufs/lfs/lfs_extern.h  Tue Feb 18 20:23:17 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_extern.h,v 1.114 2018/08/22 01:05:24 msaitoh Exp $ */
+/*     $NetBSD: lfs_extern.h,v 1.115 2020/02/18 20:23:17 chs Exp $     */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -197,7 +197,7 @@
 int lfs_match_indir(struct lfs *, struct buf *);
 int lfs_match_dindir(struct lfs *, struct buf *);
 int lfs_match_tindir(struct lfs *, struct buf *);
-void lfs_callback(struct buf *);
+void lfs_free_aiodone(struct buf *);
 void lfs_acquire_finfo(struct lfs *fs, ino_t, int);
 void lfs_release_finfo(struct lfs *fs);
 
diff -r 9022e57e2a2c -r 6efc026ea03a sys/ufs/lfs/lfs_inode.h
--- a/sys/ufs/lfs/lfs_inode.h   Tue Feb 18 17:50:32 2020 +0000
+++ b/sys/ufs/lfs/lfs_inode.h   Tue Feb 18 20:23:17 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_inode.h,v 1.23 2017/06/10 05:29:36 maya Exp $      */
+/*     $NetBSD: lfs_inode.h,v 1.24 2020/02/18 20:23:17 chs Exp $       */
 /*  from NetBSD: ulfs_inode.h,v 1.5 2013/06/06 00:51:50 dholland Exp  */
 /*  from NetBSD: inode.h,v 1.72 2016/06/03 15:36:03 christos Exp  */
 
@@ -214,7 +214,7 @@
 
 #ifdef _KERNEL
 
-# define LFS_IS_MALLOC_BUF(bp) ((bp)->b_iodone == lfs_callback)
+# define LFS_IS_MALLOC_BUF(bp) ((bp)->b_iodone == lfs_free_aiodone)
 
 /* log for debugging writes to the Ifile */
 # ifdef DEBUG
diff -r 9022e57e2a2c -r 6efc026ea03a sys/ufs/lfs/lfs_segment.c
--- a/sys/ufs/lfs/lfs_segment.c Tue Feb 18 17:50:32 2020 +0000
+++ b/sys/ufs/lfs/lfs_segment.c Tue Feb 18 20:23:17 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_segment.c,v 1.281 2020/01/15 17:55:44 ad Exp $     */
+/*     $NetBSD: lfs_segment.c,v 1.282 2020/02/18 20:23:17 chs Exp $    */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.281 2020/01/15 17:55:44 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.282 2020/02/18 20:23:17 chs Exp $");
 
 #ifdef DEBUG
 # define vndebug(vp, str) do {                                         \
@@ -109,11 +109,8 @@
 
 MALLOC_JUSTDEFINE(M_SEGMENT, "LFS segment", "Segment for LFS");
 
-static void lfs_generic_callback(struct buf *, void (*)(struct buf *));
-static void lfs_free_aiodone(struct buf *);
 static void lfs_super_aiodone(struct buf *);
 static void lfs_cluster_aiodone(struct buf *);
-static void lfs_cluster_callback(struct buf *);
 
 /*
  * Determine if it's OK to start a partial in this segment, or if we need
@@ -136,7 +133,6 @@
 
 int     lfs_match_fake(struct lfs *, struct buf *);
 void    lfs_newseg(struct lfs *);
-void    lfs_supercallback(struct buf *);
 void    lfs_updatemeta(struct segment *);
 void    lfs_writesuper(struct lfs *, daddr_t);
 int     lfs_writevnodes(struct lfs *fs, struct mount *mp,
@@ -2007,7 +2003,7 @@
        bp = getiobuf(vp, true);
        bp->b_dev = NODEV;
        bp->b_blkno = bp->b_lblkno = addr;
-       bp->b_iodone = lfs_cluster_callback;
+       bp->b_iodone = lfs_cluster_aiodone;
        bp->b_private = cl;
 
        return bp;
@@ -2430,7 +2426,7 @@
        bp->b_flags = (bp->b_flags & ~B_READ) | B_ASYNC;
        bp->b_oflags &= ~(BO_DONE | BO_DELWRI);
        bp->b_error = 0;
-       bp->b_iodone = lfs_supercallback;
+       bp->b_iodone = lfs_super_aiodone;
 
        if (fs->lfs_sp != NULL && fs->lfs_sp->seg_flags & SEGM_SYNC)
                BIO_SETPRIO(bp, BPRIO_TIMECRITICAL);
@@ -2508,7 +2504,7 @@
        return (lbn < 0 && (-lbn - ULFS_NDADDR) % LFS_NINDIR(fs) == 2);
 }
 
-static void
+void
 lfs_free_aiodone(struct buf *bp)
 {
        struct lfs *fs;
@@ -2675,43 +2671,6 @@
        pool_put(&fs->lfs_clpool, cl);
 }



Home | Main Index | Thread Index | Old Index