All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@redhat.com>
To: axboe@kernel.dk
Cc: linux-block@vger.kernel.org, dm-devel@redhat.com, hch@lst.de
Subject: Re: [dm-devel] [PATCH v2 3/3] dm: properly fix redundant bio-based IO accounting
Date: Thu, 27 Jan 2022 23:08:00 -0500	[thread overview]
Message-ID: <YfNsIP/iUX/xywO2@redhat.com> (raw)
In-Reply-To: <20220127225648.28729-4-snitzer@redhat.com>

On Thu, Jan 27 2022 at  5:56P -0500,
Mike Snitzer <snitzer@redhat.com> wrote:

> Record the start_time for a bio but defer the starting block core's IO
> accounting until after IO is submitted using bio_start_io_acct_time().
> 
> This approach avoids the need to mess around with any of the
> individual IO stats in response to a bio_split() that follows bio
> submission.
> 
> Reported-by: Bud Brown <bubrown@redhat.com>
> Cc: stable@vger.kernel.org
> Depends-on: f9893e1da2e3 ("block: add bio_start_io_acct_time() to control start_time")
> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
> ---
>  drivers/md/dm.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/md/dm.c b/drivers/md/dm.c
> index 9849114b3c08..144436301a57 100644
> --- a/drivers/md/dm.c
> +++ b/drivers/md/dm.c
> @@ -489,7 +489,7 @@ static void start_io_acct(struct dm_io *io)
>  	struct mapped_device *md = io->md;
>  	struct bio *bio = io->orig_bio;
>  
> -	io->start_time = bio_start_io_acct(bio);
> +	__bio_start_io_acct(bio, io->start_time);
>  	if (unlikely(dm_stats_used(&md->stats)))
>  		dm_stats_account_io(&md->stats, bio_data_dir(bio),
>  				    bio->bi_iter.bi_sector, bio_sectors(bio),

This should be calling bio_start_io_acct_time().
I updated the header but somehow dropped the code change before
sending.

Mike

> @@ -535,7 +535,7 @@ static struct dm_io *alloc_io(struct mapped_device *md, struct bio *bio)
>  	io->md = md;
>  	spin_lock_init(&io->endio_lock);
>  
> -	start_io_acct(io);
> +	io->start_time = READ_ONCE(jiffies);
>  
>  	return io;
>  }
> @@ -1482,6 +1482,7 @@ static void __split_and_process_bio(struct mapped_device *md,
>  			submit_bio_noacct(bio);
>  		}
>  	}
> +	start_io_acct(ci.io);
>  
>  	/* drop the extra reference count */
>  	dm_io_dec_pending(ci.io, errno_to_blk_status(error));
> -- 
> 2.15.0
> 

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


WARNING: multiple messages have this Message-ID (diff)
From: Mike Snitzer <snitzer@redhat.com>
To: axboe@kernel.dk
Cc: hch@lst.de, dm-devel@redhat.com, linux-block@vger.kernel.org
Subject: Re: [PATCH v2 3/3] dm: properly fix redundant bio-based IO accounting
Date: Thu, 27 Jan 2022 23:08:00 -0500	[thread overview]
Message-ID: <YfNsIP/iUX/xywO2@redhat.com> (raw)
In-Reply-To: <20220127225648.28729-4-snitzer@redhat.com>

On Thu, Jan 27 2022 at  5:56P -0500,
Mike Snitzer <snitzer@redhat.com> wrote:

> Record the start_time for a bio but defer the starting block core's IO
> accounting until after IO is submitted using bio_start_io_acct_time().
> 
> This approach avoids the need to mess around with any of the
> individual IO stats in response to a bio_split() that follows bio
> submission.
> 
> Reported-by: Bud Brown <bubrown@redhat.com>
> Cc: stable@vger.kernel.org
> Depends-on: f9893e1da2e3 ("block: add bio_start_io_acct_time() to control start_time")
> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
> ---
>  drivers/md/dm.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/md/dm.c b/drivers/md/dm.c
> index 9849114b3c08..144436301a57 100644
> --- a/drivers/md/dm.c
> +++ b/drivers/md/dm.c
> @@ -489,7 +489,7 @@ static void start_io_acct(struct dm_io *io)
>  	struct mapped_device *md = io->md;
>  	struct bio *bio = io->orig_bio;
>  
> -	io->start_time = bio_start_io_acct(bio);
> +	__bio_start_io_acct(bio, io->start_time);
>  	if (unlikely(dm_stats_used(&md->stats)))
>  		dm_stats_account_io(&md->stats, bio_data_dir(bio),
>  				    bio->bi_iter.bi_sector, bio_sectors(bio),

This should be calling bio_start_io_acct_time().
I updated the header but somehow dropped the code change before
sending.

Mike

> @@ -535,7 +535,7 @@ static struct dm_io *alloc_io(struct mapped_device *md, struct bio *bio)
>  	io->md = md;
>  	spin_lock_init(&io->endio_lock);
>  
> -	start_io_acct(io);
> +	io->start_time = READ_ONCE(jiffies);
>  
>  	return io;
>  }
> @@ -1482,6 +1482,7 @@ static void __split_and_process_bio(struct mapped_device *md,
>  			submit_bio_noacct(bio);
>  		}
>  	}
> +	start_io_acct(ci.io);
>  
>  	/* drop the extra reference count */
>  	dm_io_dec_pending(ci.io, errno_to_blk_status(error));
> -- 
> 2.15.0
> 


  parent reply	other threads:[~2022-01-28  4:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-27 22:56 [dm-devel] [PATCH v2 0/3] block/dm: fix bio-based DM IO accounting Mike Snitzer
2022-01-27 22:56 ` Mike Snitzer
2022-01-27 22:56 ` [dm-devel] [PATCH v2 1/3] block: add bio_start_io_acct_time() to control start_time Mike Snitzer
2022-01-27 22:56   ` Mike Snitzer
2022-01-27 22:56 ` [dm-devel] [PATCH v2 2/3] dm: revert partial fix for redundant bio-based IO accounting Mike Snitzer
2022-01-27 22:56   ` Mike Snitzer
2022-01-27 22:56 ` [dm-devel] [PATCH v2 3/3] dm: properly fix " Mike Snitzer
2022-01-27 22:56   ` Mike Snitzer
2022-01-28  3:48   ` kernel test robot
2022-01-28  4:08   ` Mike Snitzer [this message]
2022-01-28  4:08     ` Mike Snitzer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YfNsIP/iUX/xywO2@redhat.com \
    --to=snitzer@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=dm-devel@redhat.com \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.