Skip to content

Commit b88efd4

Browse files
committed
dm mpath: delay the requeue of blk-mq requests while all paths down
Return DM_MAPIO_DELAY_REQUEUE from .clone_and_map_rq. Also, return false from .busy, if all paths are down, so that blk-mq requests get mapped via .clone_and_map_rq -- which results in DM_MAPIO_DELAY_REQUEUE being returned to dm-rq. This change allows for a noticeable reduction in cpu utilization (reduced kworker load) while all paths are down, e.g.: system CPU idleness (as measured by fio's --idle-prof=system): before: system: 86.58% after: system: 98.60% Signed-off-by: Mike Snitzer <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]>
1 parent 7e48c76 commit b88efd4

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

drivers/md/dm-mpath.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -550,9 +550,9 @@ static int __multipath_map(struct dm_target *ti, struct request *clone,
550550
pgpath = choose_pgpath(m, nr_bytes);
551551

552552
if (!pgpath) {
553-
if (!must_push_back_rq(m))
554-
r = -EIO; /* Failed */
555-
return r;
553+
if (must_push_back_rq(m))
554+
return DM_MAPIO_DELAY_REQUEUE;
555+
return -EIO; /* Failed */
556556
} else if (test_bit(MPATHF_QUEUE_IO, &m->flags) ||
557557
test_bit(MPATHF_PG_INIT_REQUIRED, &m->flags)) {
558558
pg_init_all_paths(m);
@@ -1992,11 +1992,14 @@ static int multipath_busy(struct dm_target *ti)
19921992
struct priority_group *pg, *next_pg;
19931993
struct pgpath *pgpath;
19941994

1995-
/* pg_init in progress or no paths available */
1996-
if (atomic_read(&m->pg_init_in_progress) ||
1997-
(!atomic_read(&m->nr_valid_paths) && test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags)))
1995+
/* pg_init in progress */
1996+
if (atomic_read(&m->pg_init_in_progress))
19981997
return true;
19991998

1999+
/* no paths available, for blk-mq: rely on IO mapping to delay requeue */
2000+
if (!atomic_read(&m->nr_valid_paths) && test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags))
2001+
return (m->queue_mode != DM_TYPE_MQ_REQUEST_BASED);
2002+
20002003
/* Guess which priority_group will be used at next mapping time */
20012004
pg = lockless_dereference(m->current_pg);
20022005
next_pg = lockless_dereference(m->next_pg);

0 commit comments

Comments
 (0)