public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
From: Keith Busch <kbusch@kernel.org>
To: Cassiano Campes <cassianocampes@gmail.com>
Cc: axboe@fb.com, hch@lst.de, linux-nvme@lists.infradead.org,
	sagi@grimberg.me
Subject: Re: [PATCH] nvme: write streams are used even when streams are disabled
Date: Tue, 17 Sep 2019 11:51:49 -0600	[thread overview]
Message-ID: <20190917175148.GA13982@keith-busch> (raw)
In-Reply-To: <20190917171740.GA32566@iss>

On Tue, Sep 17, 2019 at 02:17:40PM -0300, Cassiano Campes wrote:
> Even when the streams flag at the nvme_core module is not set, the
> nvme_assign_write_stream is called unnecessarily, and the write hint
> is passed to the controller, thus resulting in a shadowed stream usage.

If the parameter was disabled when the controller was initialized,
ctrl->nr_streams is 0, so streams already will not be used.

If you start the module with the parameter enabled, but then disable it at
runtime, the controller was previously initialized to enable directives.
This should probably be writeable only at modprobe time, or you'd have
to require to reset each stream enabled controller in order to disable
the streams directives.
 
> Although the user application may pass the write_hint to the device driver,
> the user may have disabled the streams support by toggling the
> /sys/module/nvme_core/parameters/streams flag.
> 
> Later, the user may want to enable the streams support to get some write
> performance improvement, however the user will not notice any performance
> difference because the write streams separation was already happening
> although the streams flag was not set.
> 
> Signed-off-by: Cassiano Campes <cassianocampes@gmail.com>
> ---
>  drivers/nvme/host/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index d3d6b7bd6903..5a77aea0a58e 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -645,7 +645,7 @@ static inline blk_status_t nvme_setup_rw(struct nvme_ns *ns,
>  	cmnd->rw.slba = cpu_to_le64(nvme_block_nr(ns, blk_rq_pos(req)));
>  	cmnd->rw.length = cpu_to_le16((blk_rq_bytes(req) >> ns->lba_shift) - 1);
>  
> -	if (req_op(req) == REQ_OP_WRITE && ctrl->nr_streams)
> +	if (req_op(req) == REQ_OP_WRITE && ctrl->nr_streams && streams)
>  		nvme_assign_write_stream(ctrl, req, &control, &dsmgmt);
>  
>  	if (ns->ms) {
> -- 

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

      reply	other threads:[~2019-09-17 17:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-17 17:17 [PATCH] nvme: write streams are used even when streams are disabled Cassiano Campes
2019-09-17 17:51 ` Keith Busch [this message]

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=20190917175148.GA13982@keith-busch \
    --to=kbusch@kernel.org \
    --cc=axboe@fb.com \
    --cc=cassianocampes@gmail.com \
    --cc=hch@lst.de \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    /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