Skip to content

Commit

Permalink
Reduce taskq and context-switch cost of zio pipe
Browse files Browse the repository at this point in the history
When doing a read from disk, ZFS creates 3 ZIO's: a zio_null(), the
logical zio_read(), and then a physical zio. Currently, each of these
results in a separate taskq_dispatch(zio_execute).

On high-read-iops workloads, this causes a significant performance
impact. By processing all 3 ZIO's in a single taskq entry, we reduce the
overhead on taskq locking and context switching.  We accomplish this by
allowing zio_done() to return a "next zio to execute" to zio_execute().

This results in a ~12% performance increase for random reads, from
96,000 iops to 108,000 iops (with recordsize=8k, on SSD's).

Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed by: George Wilson <george.wilson@delphix.com>
Signed-off-by: Matthew Ahrens <mahrens@delphix.com>
External-issue: DLPX-59292
Closes #7736
  • Loading branch information
ahrens authored and tonyhutter committed Nov 8, 2018
1 parent b32f127 commit 45579c9
Show file tree
Hide file tree
Showing 2 changed files with 139 additions and 117 deletions.
4 changes: 2 additions & 2 deletions include/sys/zio.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ enum zio_child {
#define ZIO_CHILD_DDT_BIT ZIO_CHILD_BIT(ZIO_CHILD_DDT)
#define ZIO_CHILD_LOGICAL_BIT ZIO_CHILD_BIT(ZIO_CHILD_LOGICAL)
#define ZIO_CHILD_ALL_BITS \
(ZIO_CHILD_VDEV_BIT | ZIO_CHILD_GANG_BIT | \
(ZIO_CHILD_VDEV_BIT | ZIO_CHILD_GANG_BIT | \
ZIO_CHILD_DDT_BIT | ZIO_CHILD_LOGICAL_BIT)

enum zio_wait_type {
Expand Down Expand Up @@ -375,7 +375,7 @@ typedef struct zio_transform {
struct zio_transform *zt_next;
} zio_transform_t;

typedef int zio_pipe_stage_t(zio_t *zio);
typedef zio_t *zio_pipe_stage_t(zio_t *zio);

/*
* The io_reexecute flags are distinct from io_flags because the child must
Expand Down
Loading

0 comments on commit 45579c9

Please sign in to comment.