summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2013-11-06 07:46:31 +0000
committerdlg <dlg@openbsd.org>2013-11-06 07:46:31 +0000
commit939f0ffdec453635a0ec793479dc45bdbbbc645d (patch)
tree67e5d0c89e65345e2620165e047933161f527780 /sys
parentErrant assignment that snuck in long ago. Pointed out by deraadt@ (diff)
downloadwireguard-openbsd-939f0ffdec453635a0ec793479dc45bdbbbc645d.tar.xz
wireguard-openbsd-939f0ffdec453635a0ec793479dc45bdbbbc645d.zip
remove some abuse of bufqs where they were overloaded to store workq_tasks
for completing swap io against files. this in turn bloated struct buf. this moves from using workq_tasks to the task api, but stores the task handler in vndbuf which is allocated specially for every io in this path anyway. ok kettenis@ beck@
Diffstat (limited to 'sys')
-rw-r--r--sys/sys/buf.h11
-rw-r--r--sys/uvm/uvm_swap.c24
2 files changed, 12 insertions, 23 deletions
diff --git a/sys/sys/buf.h b/sys/sys/buf.h
index b2b27ad0c61..8bef4c7195a 100644
--- a/sys/sys/buf.h
+++ b/sys/sys/buf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: buf.h,v 1.89 2013/07/09 15:37:43 beck Exp $ */
+/* $OpenBSD: buf.h,v 1.90 2013/11/06 07:46:31 dlg Exp $ */
/* $NetBSD: buf.h,v 1.25 1997/04/09 21:12:17 mycroft Exp $ */
/*
@@ -42,7 +42,6 @@
#include <sys/queue.h>
#include <sys/tree.h>
#include <sys/mutex.h>
-#include <sys/workq.h>
#define NOLIST ((struct buf *)0x87654321)
@@ -126,19 +125,11 @@ struct bufq_nscan {
SIMPLEQ_ENTRY(buf) bqf_entries;
};
-/* Abuse bufq_fifo, for swapping to regular files. */
-struct bufq_swapreg {
- SIMPLEQ_ENTRY(buf) bqf_entries;
- struct workq_task bqf_wqtask;
-
-};
-
/* bufq link in struct buf */
union bufq_data {
struct bufq_disksort bufq_data_disksort;
struct bufq_fifo bufq_data_fifo;
struct bufq_nscan bufq_data_nscan;
- struct bufq_swapreg bufq_swapreg;
};
/*
diff --git a/sys/uvm/uvm_swap.c b/sys/uvm/uvm_swap.c
index 348a0a3623f..24c50edfa77 100644
--- a/sys/uvm/uvm_swap.c
+++ b/sys/uvm/uvm_swap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_swap.c,v 1.120 2013/11/05 06:02:45 deraadt Exp $ */
+/* $OpenBSD: uvm_swap.c,v 1.121 2013/11/06 07:46:31 dlg Exp $ */
/* $NetBSD: uvm_swap.c,v 1.40 2000/11/17 11:39:39 mrg Exp $ */
/*
@@ -50,6 +50,7 @@
#include <sys/syscallargs.h>
#include <sys/swap.h>
#include <sys/disk.h>
+#include <sys/task.h>
#if defined(NFSCLIENT)
#include <sys/socket.h>
#include <sys/domain.h>
@@ -192,7 +193,7 @@ struct vndxfer {
struct vndbuf {
struct buf vb_buf;
- struct vndxfer *vb_xfer;
+ struct task vb_task;
};
@@ -1290,7 +1291,8 @@ sw_reg_strategy(struct swapdev *sdp, struct buf *bp, int bn)
max(0, bp->b_validend - (bp->b_bcount-resid)));
}
- nbp->vb_xfer = vnx; /* patch it back in to vnx */
+ /* patch it back to the vnx */
+ task_set(&nbp->vb_task, sw_reg_iodone_internal, nbp, vnx);
/* XXX: In case the underlying bufq is disksort: */
nbp->vb_buf.b_cylinder = nbp->vb_buf.b_blkno;
@@ -1365,26 +1367,22 @@ sw_reg_start(struct swapdev *sdp)
* => note that we can recover the vndbuf struct by casting the buf ptr
*
* XXX:
- * We only put this onto a workq here, because of the maxactive game since
+ * We only put this onto a taskq here, because of the maxactive game since
* it basically requires us to call back into VOP_STRATEGY() (where we must
* be able to sleep) via sw_reg_start().
*/
void
sw_reg_iodone(struct buf *bp)
{
- struct bufq_swapreg *bq;
-
- bq = (struct bufq_swapreg *)&bp->b_bufq;
-
- workq_queue_task(NULL, &bq->bqf_wqtask, 0,
- (workq_fn)sw_reg_iodone_internal, bp, NULL);
+ struct vndbuf *vbp = (struct vndbuf *)bp;
+ task_add(systq, &vbp->vb_task);
}
void
-sw_reg_iodone_internal(void *arg0, void *unused)
+sw_reg_iodone_internal(void *xvbp, void *xvnx)
{
- struct vndbuf *vbp = (struct vndbuf *)arg0;
- struct vndxfer *vnx = vbp->vb_xfer;
+ struct vndbuf *vbp = xvbp;
+ struct vndxfer *vnx = xvnx;
struct buf *pbp = vnx->vx_bp; /* parent buffer */
struct swapdev *sdp = vnx->vx_sdp;
int resid, s;