Linux block layer
 help / color / mirror / Atom feed
From: Bart Van Assche <Bart.VanAssche@sandisk.com>
To: "jack@suse.cz" <jack@suse.cz>, "axboe@kernel.dk" <axboe@kernel.dk>
Cc: "linux-block@vger.kernel.org" <linux-block@vger.kernel.org>
Subject: Re: [PATCH] block: Make writeback throttling defaults consistent for SQ devices
Date: Fri, 14 Apr 2017 15:42:53 +0000	[thread overview]
Message-ID: <1492184571.2644.1.camel@sandisk.com> (raw)
In-Reply-To: <20170412082337.10256-1-jack@suse.cz>

On Wed, 2017-04-12 at 10:23 +0200, Jan Kara wrote:
> +#ifndef CONFIG_BLK_WBT_MQ
> +	if (q->mq_ops)
> +		return;
> +#endif
> +#ifndef CONFIG_BLK_WBT_SQ
> +	if (q->request_fn)
> +		return;
> +#endif
> +
> +	/*
> +	 * If this fails, we don't get throttling
> +	 */
> +	wbt_init(q);

Hello Jan,

How about using positive logic to enable WBT, e.g. as follows? Wouldn't
that make the code easier to read?

	if ((IS_ENABLED(CONFIG_BLK_WBT_MQ) &&=A0q->mq_ops) ||
	    (IS_ENABLED(CONFIG_BLK_WBT_SQ) && q->request_fn))
		wbt_init(q);

> +static void deadline_registered_queue(struct request_queue *q)
> +{
> +	wbt_enable_default(q);
> +}
> +
>  /*
>   * sysfs parts below
>   */
> @@ -445,6 +451,7 @@ static struct elevator_type iosched_deadline =3D {
>  		.elevator_latter_req_fn =3D	elv_rb_latter_request,
>  		.elevator_init_fn =3D		deadline_init_queue,
>  		.elevator_exit_fn =3D		deadline_exit_queue,
> +		.elevator_registered_fn =3D	deadline_registered_queue,
>  	},
> =20
>  	.elevator_attrs =3D deadline_attrs,
> [ ... ]
> @@ -91,6 +92,11 @@ static void noop_exit_queue(struct elevator_queue *e)
>  	kfree(nd);
>  }
> =20
> +static void noop_registered_queue(struct request_queue *q)
> +{
> +	wbt_enable_default(q);
> +}
> +
>  static struct elevator_type elevator_noop =3D {
>  	.ops.sq =3D {
>  		.elevator_merge_req_fn		=3D noop_merged_requests,
> @@ -100,6 +106,7 @@ static struct elevator_type elevator_noop =3D {
>  		.elevator_latter_req_fn		=3D noop_latter_request,
>  		.elevator_init_fn		=3D noop_init_queue,
>  		.elevator_exit_fn		=3D noop_exit_queue,
> +		.elevator_registered_fn		=3D noop_registered_queue,
>  	},
>  	.elevator_name =3D "noop",
>  	.elevator_owner =3D THIS_MODULE,

This approach is not suited for blk-mq because with blk-mq "none" means no
scheduler and hence no struct elevator_type. Please consider not to add any
elevator_registered_fn() callbacks to noop and deadline but instead to call
wbt_enable_default() from elv_unregister_queue().

Thanks,

Bart.=

  reply	other threads:[~2017-04-14 15:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-12  8:23 [PATCH] block: Make writeback throttling defaults consistent for SQ devices Jan Kara
2017-04-14 15:42 ` Bart Van Assche [this message]
2017-04-18 12:25   ` Jan Kara
  -- strict thread matches above, loose matches on Subject: below --
2017-04-19  9:33 Jan Kara
2017-04-19  9:41 ` Jan Kara
2017-04-19 14:34 ` Jens Axboe

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=1492184571.2644.1.camel@sandisk.com \
    --to=bart.vanassche@sandisk.com \
    --cc=axboe@kernel.dk \
    --cc=jack@suse.cz \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox