From: Christoph Hellwig <hch@lst.de>
To: John Meneghini <jmeneghi@redhat.com>
Cc: kbusch@kernel.org, hch@lst.de, sagi@grimberg.me,
emilne@redhat.com, linux-nvme@lists.infradead.org,
linux-kernel@vger.kernel.org, jrani@purestorage.com,
randyj@purestorage.com, hare@kernel.org
Subject: Re: [PATCH v5] nvme: multipath: Implemented new iopolicy "queue-depth"
Date: Thu, 23 May 2024 08:52:57 +0200 [thread overview]
Message-ID: <20240523065257.GB28524@lst.de> (raw)
In-Reply-To: <20240522165406.702362-1-jmeneghi@redhat.com>
> + /*
> + * queue-depth iopolicy does not need to reference ->current_path
> + * but round-robin needs the last path used to advance to the
> + * next one, and numa will continue to use the last path unless
> + * it is or has become not optimized
> + */
Can we please turn this into a full sentence? I.e.:
/*
* The queue-depth iopolicy does not need to reference ->current_path,
* but the round-robin iopolicy needs the last path used to advance to
* the next one, and numa will continue to use the last path unless
* it is or has become non-optimized.
*/
?
> + if (iopolicy == NVME_IOPOLICY_QD)
> + return nvme_queue_depth_path(head);
> +
> + node = numa_node_id();
> ns = srcu_dereference(head->current_path[node], &head->srcu);
> if (unlikely(!ns))
> return __nvme_find_path(head, node);
>
> - if (READ_ONCE(head->subsys->iopolicy) == NVME_IOPOLICY_RR)
> + if (iopolicy == NVME_IOPOLICY_RR)
> return nvme_round_robin_path(head, node, ns);
> +
> if (unlikely(!nvme_path_is_optimized(ns)))
> return __nvme_find_path(head, node);
> return ns;
Also this is growing into the kind of spaghetti code that is on the fast
path to become unmaintainable. I'd much rather see the
srcu_dereference + __nvme_find_path duplicated and have a switch over
the iopolicies with a separate helper for each of them here than the
various ifs at different levels.
> +static void nvme_subsys_iopolicy_update(struct nvme_subsystem *subsys, int iopolicy)
Overly long line here.
> +{
> + struct nvme_ctrl *ctrl;
> + int old_iopolicy = READ_ONCE(subsys->iopolicy);
> +
> + if (old_iopolicy == iopolicy)
> + return;
> +
> + WRITE_ONCE(subsys->iopolicy, iopolicy);
> +
> + /* iopolicy changes reset the counters and clear the mpath by design */
> + mutex_lock(&nvme_subsystems_lock);
> + list_for_each_entry(ctrl, &subsys->ctrls, subsys_entry) {
> + atomic_set(&ctrl->nr_active, 0);
> + nvme_mpath_clear_ctrl_paths(ctrl);
> + }
> + mutex_unlock(&nvme_subsystems_lock);
You probably want to take the lock over the iopolicy assignment to
serialize it. And why do we need the atomic_set here?
> +
> + pr_notice("%s: changed from %s to %s for subsysnqn %s\n", __func__,
> + nvme_iopolicy_names[old_iopolicy], nvme_iopolicy_names[iopolicy],
Pleae avoid the overly long line here as well.
> NVME_REQ_CANCELLED = (1 << 0),
> NVME_REQ_USERCMD = (1 << 1),
> NVME_MPATH_IO_STATS = (1 << 2),
> + NVME_MPATH_CNT_ACTIVE = (1 << 3),
This does not match the indentation above.
next prev parent reply other threads:[~2024-05-23 6:53 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-22 16:54 [PATCH v5] nvme: multipath: Implemented new iopolicy "queue-depth" John Meneghini
2024-05-22 17:32 ` Keith Busch
2024-05-23 6:45 ` Christoph Hellwig
2024-05-23 13:12 ` John Meneghini
2024-05-23 13:16 ` Christoph Hellwig
2024-05-23 13:33 ` John Meneghini
2024-05-23 15:56 ` Keith Busch
2024-05-23 3:00 ` John Meneghini
2024-05-23 4:29 ` Chaitanya Kulkarni
2024-05-23 6:28 ` Hannes Reinecke
2024-05-23 13:42 ` John Meneghini
2024-05-23 19:33 ` Chaitanya Kulkarni
2024-05-23 19:28 ` Chaitanya Kulkarni
2024-05-23 6:52 ` Christoph Hellwig [this message]
2024-05-23 15:08 ` John Meneghini
2024-05-23 8:14 ` Christoph Hellwig
2024-05-23 16:07 ` John Meneghini
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=20240523065257.GB28524@lst.de \
--to=hch@lst.de \
--cc=emilne@redhat.com \
--cc=hare@kernel.org \
--cc=jmeneghi@redhat.com \
--cc=jrani@purestorage.com \
--cc=kbusch@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=randyj@purestorage.com \
--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