All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@redhat.com>
To: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
Cc: axboe@kernel.dk, Frank Mayhar <fmayhar@google.com>,
	device-mapper development <dm-devel@redhat.com>,
	Mikulas Patocka <mpatocka@redhat.com>
Subject: Re: [PATCH 7/7] dm: optimize clone_rq() when track_peak_rq_based_ios is disabled
Date: Fri, 13 Sep 2013 09:04:29 -0400	[thread overview]
Message-ID: <20130913130429.GB3989@redhat.com> (raw)
In-Reply-To: <523298B3.9050400@ce.jp.nec.com>

On Fri, Sep 13 2013 at 12:46am -0400,
Jun'ichi Nomura <j-nomura@ce.jp.nec.com> wrote:

> On 09/13/13 08:53, Mike Snitzer wrote:
> > On Thu, Sep 12 2013 at  7:30pm -0400,
> > Mikulas Patocka <mpatocka@redhat.com> wrote:
> >>>>> Make use of static keys to eliminate the relevant branch in clone_rq()
> >>>>> when dm_mod's 'track_peak_rq_based_ios' paramter is set to 0 (disabled).
> >>>>>
> >>>>> Even if 'track_peak_rq_based_ios' is set to 0 it will not take effect
> >>>>> until the next request-based table reload.  Once it is disabled the
> >>>>> 'peak_rq_based_ios' parameter will be reset to 0.
> >>>>
> >>>> This patch changes it so that the value track_peak_rq_based_ios is sampled 
> >>>> only when reloading a table. I think it will be confusing to the user if 
> >>>> he changes the value, but the change doesn't take effect until something 
> >>>> reloads some table.
> >>>
> >>> Well we need to be able to notice the change but I do not wish to do so
> >>> in a performance critical path (which clone_rq is).
> >>
> >> I think one condition isn't that bad so there is no need to use static 
> >> keys.
> > 
> > Considering we're talking about the IO path I'd rather avoid it given
> > 'track_peak_rq_based_ios' will almost always be disabled.
> > 
> >> If you want to use static keys, you need to refresh them in some place 
> >> that it called regularly.
> > 
> > No you don't.  I'm assuming if someone enables 'track_peak_rq_based_ios'
> > they know what they are doing.
> > 
> > But I'm open to suggestions on a more appropriate hook to be catching
> > the update to track_peak_rq_based_ios.
> 
> Other approach might be putting the info on tracepoints.
> Then the tracepoint framework will take care of the static_key thing.
> 
> Since 'the number of bios in a request' is a block-layer generic info,
> you could extend the block layer events instead of having your own.

Sounds good, I like this better.
 
> Attached patch adds it to block_rq_remap event.
> You could do something like this to see requests with many bios:
>   echo 'nr_bios > 32' > /sys/kernel/debug/tracing/events/block/block_rq_remap/filter
>   echo 1 > /sys/kernel/debug/tracing/events/block/block_rq_remap/enable 
> 
> For example,
>      kworker/1:1H-308   [001] d..1   276.242448: block_rq_remap: 8,64 W 1967760 + 512 <- (253,1) 1967760 64
>      kworker/1:1H-308   [001] d..1   276.242482: block_rq_remap: 8,160 W 1968272 + 512 <- (253,1) 1968272 64
>      kworker/1:1H-308   [001] d..1   276.242515: block_rq_remap: 65,0 W 1968784 + 512 <- (253,1) 1968784 64
> # the last item in line is the number of bios. ("64" in this case)

Acked-by: Mike Snitzer <snitzer@redhat.com>

Any chance you'd be open to adding a proper header (with your
Signed-off-by, my Ack, etc) and cc Jens on v2?

I can do it if you'd like but figured it more appropriate for you to
submit your work.

Thanks,
Mike

Jens, FYI here is the patch Jun'ichi developed as an alternative to these
2 DM-specific patches:
http://www.redhat.com/archives/dm-devel/2013-September/msg00030.html
http://www.redhat.com/archives/dm-devel/2013-September/msg00031.html

> diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
> index 2fdb4a4..0e6f765 100644
> --- a/include/linux/blkdev.h
> +++ b/include/linux/blkdev.h
> @@ -862,6 +862,17 @@ static inline unsigned int blk_rq_get_max_sectors(struct request *rq)
>  	return blk_queue_get_max_sectors(q, rq->cmd_flags);
>  }
>  
> +static inline unsigned int blk_rq_count_bios(struct request *rq)
> +{
> +	unsigned int nr_bios = 0;
> +	struct bio *bio;
> +
> +	__rq_for_each_bio(bio, rq)
> +		nr_bios++;
> +
> +	return nr_bios;
> +}
> +
>  /*
>   * Request issue related functions.
>   */
> diff --git a/include/trace/events/block.h b/include/trace/events/block.h
> index 60ae7c3..4c2301d 100644
> --- a/include/trace/events/block.h
> +++ b/include/trace/events/block.h
> @@ -618,6 +618,7 @@ TRACE_EVENT(block_rq_remap,
>  		__field( unsigned int,	nr_sector	)
>  		__field( dev_t,		old_dev		)
>  		__field( sector_t,	old_sector	)
> +		__field( unsigned int,	nr_bios		)
>  		__array( char,		rwbs,	RWBS_LEN)
>  	),
>  
> @@ -627,15 +628,16 @@ TRACE_EVENT(block_rq_remap,
>  		__entry->nr_sector	= blk_rq_sectors(rq);
>  		__entry->old_dev	= dev;
>  		__entry->old_sector	= from;
> +		__entry->nr_bios	= blk_rq_count_bios(rq);
>  		blk_fill_rwbs(__entry->rwbs, rq->cmd_flags, blk_rq_bytes(rq));
>  	),
>  
> -	TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu",
> +	TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu %u",
>  		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
>  		  (unsigned long long)__entry->sector,
>  		  __entry->nr_sector,
>  		  MAJOR(__entry->old_dev), MINOR(__entry->old_dev),
> -		  (unsigned long long)__entry->old_sector)
> +		  (unsigned long long)__entry->old_sector, __entry->nr_bios)
>  );
>  
>  #endif /* _TRACE_BLOCK_H */
> 
> --
> dm-devel mailing list
> dm-devel@redhat.com
> https://www.redhat.com/mailman/listinfo/dm-devel

  reply	other threads:[~2013-09-13 13:04 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-09 17:48 [PATCH] dm: Make MIN_IOS, et al, tunable via sysctl Frank Mayhar
2013-08-13 16:41 ` Frank Mayhar
2013-08-16 22:58 ` Frank Mayhar
2013-08-17 12:30 ` [dm-devel] " Alasdair G Kergon
2013-08-19 13:40   ` Mike Snitzer
2013-08-19 15:04     ` Frank Mayhar
2013-08-19 14:00 ` Mike Snitzer
2013-08-19 14:00   ` Mike Snitzer
2013-08-19 17:54   ` [dm-devel] " Frank Mayhar
2013-08-19 18:15     ` Mike Snitzer
2013-08-20 21:44     ` [dm-devel] " Mikulas Patocka
2013-08-20 21:52       ` Frank Mayhar
2013-08-20 21:41   ` Mikulas Patocka
2013-08-20 21:22 ` [dm-devel] [PATCH] " Mikulas Patocka
2013-08-20 21:28   ` Frank Mayhar
2013-08-20 21:47     ` Mikulas Patocka
2013-08-20 21:57       ` Frank Mayhar
2013-08-20 22:24         ` Mike Snitzer
2013-08-20 22:52           ` Mikulas Patocka
2013-08-20 23:14           ` Frank Mayhar
2013-08-22 17:26             ` Frank Mayhar
2013-08-26 14:28             ` Mikulas Patocka
2013-09-12 22:24               ` [PATCH 0/7] dm: allow mempool and bioset reserves to be tuned Mike Snitzer
2013-09-12 22:24                 ` [PATCH 1/7] dm: lower bio-based mempool reservation Mike Snitzer
2013-09-12 22:40                   ` Mikulas Patocka
2013-09-12 22:24                 ` [PATCH 2/7] dm: add reserved_rq_based_ios module parameter Mike Snitzer
2013-09-12 22:45                   ` Mikulas Patocka
2013-09-12 23:15                     ` Mike Snitzer
2013-09-12 23:27                       ` Mikulas Patocka
2013-09-12 23:32                         ` Mike Snitzer
2013-09-12 22:24                 ` [PATCH 3/7] dm: add reserved_bio_based_ios " Mike Snitzer
2013-09-12 22:47                   ` Mikulas Patocka
2013-09-12 23:11                     ` Mike Snitzer
2013-09-12 23:17                       ` Mikulas Patocka
2013-09-18 15:17                         ` Frank Mayhar
2013-09-12 22:24                 ` [PATCH 4/7] dm io: use dm_get_reserved_bio_based_ios to size reserves Mike Snitzer
2013-09-12 22:48                   ` Mikulas Patocka
2013-09-12 22:24                 ` [PATCH 5/7] dm mpath: use dm_get_reserved_rq_based_ios to size mempool Mike Snitzer
2013-09-12 22:48                   ` Mikulas Patocka
2013-09-12 22:24                 ` [PATCH 6/7] dm: track the maximum number of bios in a cloned request Mike Snitzer
2013-09-12 22:55                   ` Mikulas Patocka
2013-09-12 23:09                     ` Mike Snitzer
2013-09-12 22:24                 ` [PATCH 7/7] dm: optimize clone_rq() when track_peak_rq_based_ios is disabled Mike Snitzer
2013-09-12 23:00                   ` Mikulas Patocka
2013-09-12 23:06                     ` Mike Snitzer
2013-09-12 23:30                       ` Mikulas Patocka
2013-09-12 23:53                         ` Mike Snitzer
2013-09-13  4:46                           ` Jun'ichi Nomura
2013-09-13 13:04                             ` Mike Snitzer [this message]
2013-09-13 14:34                             ` Mikulas Patocka
2013-09-13 18:59                 ` [PATCH v2 0/3] dm: allow mempool and bioset reserves to be tuned Mike Snitzer
2013-09-13 18:59                   ` [PATCH v2 1/3] dm: lower bio-based mempool reservation Mike Snitzer
2013-09-13 18:59                   ` [PATCH v2 2/3] dm: add reserved_rq_based_ios module parameter Mike Snitzer
2013-09-13 18:59                   ` [PATCH v2 3/3] dm: add reserved_bio_based_ios " Mike Snitzer
2013-09-13 19:22                   ` [PATCH v2 0/3] dm: allow mempool and bioset reserves to be tuned Mike Snitzer
2013-09-13 20:30                     ` Mike Snitzer
2013-09-13 21:08                       ` [PATCH v3 " Mike Snitzer
2013-09-13 21:08                         ` [PATCH v3 1/3] dm: lower bio-based mempool reservation Mike Snitzer
2013-09-13 21:08                         ` [PATCH v3 2/3] dm: add reserved_rq_based_ios module parameter Mike Snitzer
2013-09-13 21:08                         ` [PATCH v3 3/3] dm: add reserved_bio_based_ios " Mike Snitzer
2013-09-18 15:10                         ` [PATCH v3 0/3] dm: allow mempool and bioset reserves to be tuned Frank Mayhar

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=20130913130429.GB3989@redhat.com \
    --to=snitzer@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=dm-devel@redhat.com \
    --cc=fmayhar@google.com \
    --cc=j-nomura@ce.jp.nec.com \
    --cc=mpatocka@redhat.com \
    /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.