From: Hannes Reinecke <hare@suse.de>
To: Daniel Wagner <dwagner@suse.de>, Saravanan D <saravanand@crusoe.ai>
Cc: linux-nvme@lists.infradead.org, kbusch@kernel.org, hch@lst.de,
sagi@grimberg.me, axboe@kernel.dk, nilay@linux.ibm.com,
sgogte@purestorage.com, hare@kernel.org,
linux-kernel@vger.kernel.org, iyamahata@crusoe.ai,
kiyer@crusoe.ai, ganbalagane@crusoe.ai, sjpark@crusoe.ai
Subject: Re: [PATCH v5 2/2] nvme-tcp: allow setting per-queue io_cpu through sysfs
Date: Wed, 21 Oct 2026 09:21:09 +0200 [thread overview]
Message-ID: <72fce5bb-b256-42aa-8844-f970c4480ad3@suse.de> (raw)
In-Reply-To: <0ee4d281-61b4-458e-92c6-7fff3e50c0ec@flourine.local>
On 10/20/26 5:28 PM, Daniel Wagner wrote:
> On Sat, Oct 17, 2026 at 06:00:59PM -0700, Saravanan D wrote:
>> nvme_tcp_set_queue_io_cpu() picks each queue's io_cpu at connect time
>> as the least loaded CPU in the queue's blk-mq map group, and all socket
>> work runs there for the connection's lifetime. This decision falls
>> short when the host partitions its CPUs after connect time. On a 384
>> cpu multi tenant host with 128 queue controllers, blk-mq folds three
>> CPUs into every map group, some groups straddle two tenants' cpusets,
>> and 9% of nvme_tcp_io_work executions ran outside the submitting VM's
>> cpuset, seen by the neighbor as steal time.
>>
>> Expose the io_cpu in each I/O queue's directory
>>
>> /sys/class/nvme/nvmeX/queues/<qid>/io_cpu
>>
>> so a control plane that owns CPU placement can set it directly instead
>> of relying on the driver's heuristic. The attribute accepts a decimal
>> cpu number, -1 or "unbound". A user assignment, unbound included, is
>> marked in the queue flags, persists across reconnects and is never
>> reselected by the driver. The read-only managed attribute reports 1
>> while io_cpu is driver managed and 0 once the user assigned it. The
>> accounting of nvme_tcp_cpu_queues applies regardless of who set the
>> io_cpu.
>>
>> A queue's directory is added when the queue is allocated and removed
>> when it is freed, before the queue is torn down, so a sysfs store
>> never runs on a freed queue. The queues directory is created before
>> the I/O queues are set up in parallel. All io_cpu writes, from sysfs
>> and from the driver, serialize with the accounting under
>> nvme_tcp_cpu_queues_lock, while the I/O paths read io_cpu locklessly.
>> The queue stop now clears NVME_TCP_Q_IO_CPU_SET under that lock, since
>> a sysfs store may move io_cpu in between.
>>
>> nvme_tcp_free_queue() now clears NVME_TCP_Q_IO_CPU_SET and drops its
>> count, because a queue can still be counted when it is freed. A sysfs
>> store may have run after the queue stop, or the connect may have
>> failed, and the setup error path frees such a queue without calling
>> nvme_tcp_stop_queue(), where the count is normally dropped.
>
> This looks good, just trying to wrap my head around with isolcpu (yeah,
> doing a bit of work in that area makes me a paranoid).
>
> I think it make sense to allow that the user can change queue CPU
> pinning during runtime even with isolcpu enabled. And then the question
> is should this be connected to cgroups?
Not sure if cgroups is the right concept here; cgroups are user/
application centric whereas nvme-tcp is pretty much queue/cpu centric.
IE after all the cgroup calculations are done.
Don't think cgroups are a good fit here.
Cheers,
Hannes
--
Dr. Hannes Reinecke Kernel Storage Architect
hare@suse.de +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich
next prev parent reply other threads:[~2026-10-21 7:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-18 1:00 [PATCH v5 0/2] " Saravanan D
2026-10-18 1:00 ` [PATCH v5 1/2] nvme: add per-queue sysfs directories Saravanan D
2026-10-18 1:00 ` [PATCH v5 2/2] nvme-tcp: allow setting per-queue io_cpu through sysfs Saravanan D
2026-10-20 15:28 ` Daniel Wagner
2026-10-21 7:21 ` Hannes Reinecke [this message]
2026-10-21 8:19 ` Daniel Wagner
2026-10-21 10:00 ` Saravanan D
2026-10-21 7:28 ` Hannes Reinecke
2026-10-21 9:53 ` Saravanan D
[not found] ` <sashiko-outbox-175868@kernel.org>
2026-10-21 9:45 ` Saravanan D
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=72fce5bb-b256-42aa-8844-f970c4480ad3@suse.de \
--to=hare@suse.de \
--cc=axboe@kernel.dk \
--cc=dwagner@suse.de \
--cc=ganbalagane@crusoe.ai \
--cc=hare@kernel.org \
--cc=hch@lst.de \
--cc=iyamahata@crusoe.ai \
--cc=kbusch@kernel.org \
--cc=kiyer@crusoe.ai \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=nilay@linux.ibm.com \
--cc=sagi@grimberg.me \
--cc=saravanand@crusoe.ai \
--cc=sgogte@purestorage.com \
--cc=sjpark@crusoe.ai \
/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
all inboxes | Powered by JetHome®