Skip to content

Commit

Permalink
dm: do not call dm_sync_table() when creating new devices
Browse files Browse the repository at this point in the history
When creating new devices dm_sync_table() calls
synchronize_rcu_expedited(), causing _all_ pending RCU pointers to be
flushed. This causes a latency overhead that is especially noticeable
when creating lots of devices.

And all of this is pointless as there are no old maps to be
disconnected, and hence no stale pointers which would need to be
cleared up.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
  • Loading branch information
Hannes Reinecke authored and Mike Snitzer committed Nov 10, 2014
1 parent 6fa9952 commit 41abc4e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions drivers/md/dm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2341,7 +2341,8 @@ static struct dm_table *__bind(struct mapped_device *md, struct dm_table *t,
set_bit(DMF_MERGE_IS_OPTIONAL, &md->flags);
else
clear_bit(DMF_MERGE_IS_OPTIONAL, &md->flags);
dm_sync_table(md);
if (old_map)
dm_sync_table(md);

return old_map;
}
Expand Down Expand Up @@ -2782,7 +2783,8 @@ int dm_suspend(struct mapped_device *md, unsigned suspend_flags)
* flush_workqueue(md->wq).
*/
set_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags);
synchronize_srcu(&md->io_barrier);
if (map)
synchronize_srcu(&md->io_barrier);

/*
* Stop md->queue before flushing md->wq in case request-based
Expand All @@ -2802,7 +2804,8 @@ int dm_suspend(struct mapped_device *md, unsigned suspend_flags)

if (noflush)
clear_bit(DMF_NOFLUSH_SUSPENDING, &md->flags);
synchronize_srcu(&md->io_barrier);
if (map)
synchronize_srcu(&md->io_barrier);

/* were we interrupted ? */
if (r < 0) {
Expand Down

0 comments on commit 41abc4e

Please sign in to comment.