From: Max Gurtovoy <mgurtovoy@nvidia.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: <mst@redhat.com>, <virtualization@lists.linux-foundation.org>,
<kvm@vger.kernel.org>, <oren@nvidia.com>, <nitzanc@nvidia.com>,
<israelr@nvidia.com>, <hch@infradead.org>,
<linux-block@vger.kernel.org>, <axboe@kernel.dk>
Subject: Re: [PATCH 2/2] virtio-blk: set NUMA affinity for a tagset
Date: Thu, 30 Sep 2021 16:24:45 +0300 [thread overview]
Message-ID: <c9d92698-207f-e97d-c753-6c07977d523d@nvidia.com> (raw)
In-Reply-To: <YVW4yIkWWEUMsBLp@stefanha-x1.localdomain>
On 9/30/2021 4:16 PM, Stefan Hajnoczi wrote:
> On Wed, Sep 29, 2021 at 06:07:52PM +0300, Max Gurtovoy wrote:
>> On 9/28/2021 9:47 AM, Stefan Hajnoczi wrote:
>>> On Mon, Sep 27, 2021 at 08:39:30PM +0300, Max Gurtovoy wrote:
>>>> On 9/27/2021 11:09 AM, Stefan Hajnoczi wrote:
>>>>> On Sun, Sep 26, 2021 at 05:55:18PM +0300, Max Gurtovoy wrote:
>>>>>> To optimize performance, set the affinity of the block device tagset
>>>>>> according to the virtio device affinity.
>>>>>>
>>>>>> Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com>
>>>>>> ---
>>>>>> drivers/block/virtio_blk.c | 2 +-
>>>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>>
>>>>>> diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
>>>>>> index 9b3bd083b411..1c68c3e0ebf9 100644
>>>>>> --- a/drivers/block/virtio_blk.c
>>>>>> +++ b/drivers/block/virtio_blk.c
>>>>>> @@ -774,7 +774,7 @@ static int virtblk_probe(struct virtio_device *vdev)
>>>>>> memset(&vblk->tag_set, 0, sizeof(vblk->tag_set));
>>>>>> vblk->tag_set.ops = &virtio_mq_ops;
>>>>>> vblk->tag_set.queue_depth = queue_depth;
>>>>>> - vblk->tag_set.numa_node = NUMA_NO_NODE;
>>>>>> + vblk->tag_set.numa_node = virtio_dev_to_node(vdev);
>>>>>> vblk->tag_set.flags = BLK_MQ_F_SHOULD_MERGE;
>>>>>> vblk->tag_set.cmd_size =
>>>>>> sizeof(struct virtblk_req) +
>>>>> I implemented NUMA affinity in the past and could not demonstrate a
>>>>> performance improvement:
>>>>> https://lists.linuxfoundation.org/pipermail/virtualization/2020-June/048248.html
>>>>>
>>>>> The pathological case is when a guest with vNUMA has the virtio-blk-pci
>>>>> device on the "wrong" host NUMA node. Then memory accesses should cross
>>>>> NUMA nodes. Still, it didn't seem to matter.
>>>> I think the reason you didn't see any improvement is since you didn't use
>>>> the right device for the node query. See my patch 1/2.
>>> That doesn't seem to be the case. Please see
>>> drivers/base/core.c:device_add():
>>>
>>> /* use parent numa_node */
>>> if (parent && (dev_to_node(dev) == NUMA_NO_NODE))
>>> set_dev_node(dev, dev_to_node(parent));
>>>
>>> IMO it's cleaner to use dev_to_node(&vdev->dev) than to directly access
>>> the parent.
>>>
>>> Have I missed something?
>> but dev_to_node(dev) is 0 IMO.
>>
>> who set it to NUMA_NO_NODE ?
> drivers/virtio/virtio.c:register_virtio_device():
>
> device_initialize(&dev->dev);
>
> drivers/base/core.c:device_initialize():
>
> set_dev_node(dev, -1);
Ohh I was searching NUMA_NO_NODE. I guess the initial commit from
Christoph 15 years ago was before adding this macro.
I'll send a patch to fix it.
I hope I'll have a system to check your patches next week.
>
> Stefan
next prev parent reply other threads:[~2021-09-30 13:25 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-26 14:55 [PATCH 1/2] virtio: introduce virtio_dev_to_node helper Max Gurtovoy
2021-09-26 14:55 ` [PATCH 2/2] virtio-blk: set NUMA affinity for a tagset Max Gurtovoy
2021-09-27 8:09 ` Stefan Hajnoczi
2021-09-27 17:39 ` Max Gurtovoy
2021-09-28 6:47 ` Stefan Hajnoczi
2021-09-29 15:07 ` Max Gurtovoy
2021-09-30 13:16 ` Stefan Hajnoczi
2021-09-30 13:24 ` Max Gurtovoy [this message]
2021-09-27 11:34 ` Leon Romanovsky
2021-09-27 17:25 ` Max Gurtovoy
2021-09-27 18:23 ` Leon Romanovsky
2021-09-28 15:59 ` Max Gurtovoy
2021-09-28 16:27 ` Leon Romanovsky
2021-09-28 23:28 ` Max Gurtovoy
2021-09-29 6:50 ` Leon Romanovsky
2021-09-29 9:48 ` Max Gurtovoy
2021-09-27 8:02 ` [PATCH 1/2] virtio: introduce virtio_dev_to_node helper Stefan Hajnoczi
2021-09-27 9:31 ` Michael S. Tsirkin
2021-09-28 16:14 ` Max Gurtovoy
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=c9d92698-207f-e97d-c753-6c07977d523d@nvidia.com \
--to=mgurtovoy@nvidia.com \
--cc=axboe@kernel.dk \
--cc=hch@infradead.org \
--cc=israelr@nvidia.com \
--cc=kvm@vger.kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=mst@redhat.com \
--cc=nitzanc@nvidia.com \
--cc=oren@nvidia.com \
--cc=stefanha@redhat.com \
--cc=virtualization@lists.linux-foundation.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