From: Waiman Long <longman@redhat.com>
To: Mikulas Patocka <mpatocka@redhat.com>
Cc: Tejun Heo <tj@kernel.org>, Lai Jiangshan <jiangshanlai@gmail.com>,
Mike Snitzer <snitzer@kernel.org>,
Laurence Oberman <loberman@redhat.com>,
Jonathan Brassow <jbrassow@redhat.com>,
Ming Lei <minlei@redhat.com>, Ondrej Kozina <okozina@redhat.com>,
Milan Broz <gmazyland@gmail.com>,
linux-kernel@vger.kernel.org, dm-devel@lists.linux.dev
Subject: Re: dm-crypt performance regression due to workqueue changes
Date: Sun, 30 Jun 2024 10:35:40 -0400 [thread overview]
Message-ID: <4bad11b8-b257-44de-87a5-cf428eaa9a64@redhat.com> (raw)
In-Reply-To: <e5e5b436-17a6-aafe-2f61-eb659fa35ae2@redhat.com>
On 6/30/24 05:49, Mikulas Patocka wrote:
>
> On Sat, 29 Jun 2024, Waiman Long wrote:
>
>> On 6/29/24 14:15, Mikulas Patocka wrote:
>>> Hi
>>>
>>> I report that the patch 63c5484e74952f60f5810256bd69814d167b8d22
>>> ("workqueue: Add multiple affinity scopes and interface to select them")
>>> is causing massive dm-crypt slowdown in virtual machines.
>>>
>>> Steps to reproduce:
>>> * Install a system in a virtual machine with 16 virtual CPUs
>>> * Create a scratch file with "dd if=/dev/zero of=Scratch.img bs=1M
>>> count=2048 oflag=direct" - the file should be on a fast NVMe drive
>>> * Attach the scratch file to the virtual machine as /dev/vdb; cache mode
>>> should be 'none'
>>> * cryptsetup --force-password luksFormat /dev/vdb
>>> * cryptsetup luksOpen /dev/vdb cr
>>> * fio --direct=1 --bsrange=128k-128k --runtime=40 --numjobs=1
>>> --ioengine=libaio --iodepth=8 --group_reporting=1
>>> --filename=/dev/mapper/cr --name=job --rw=read
>>>
>>> With 6.5, we get 3600MiB/s; with 6.6 we get 1400MiB/s.
>>>
>>> The reason is that virt-manager by default sets up a topology where we
>>> have 16 sockets, 1 core per socket, 1 thread per core. And that workqueue
>>> patch avoids moving work items across sockets, so it processes all
>>> encryption work only on one virtual CPU.
>>>
>>> The performance degradation may be fixed with "echo 'system'
>>>> /sys/module/workqueue/parameters/default_affinity_scope" - but it is
>>> regression anyway, as many users don't know about this option.
>>>
>>> How should we fix it? There are several options:
>>> 1. revert back to 'numa' affinity
>>> 2. revert to 'numa' affinity only if we are in a virtual machine
>>> 3. hack dm-crypt to set the 'numa' affinity for the affected workqueues
>>> 4. any other solution?
>> Another alternative is to go back to the old "numa" default if the kernel is
>> running under a hypervisor since the cpu configuration information is likely
>> to be incorrect anyway. The current default of "cache" will remain if not
>> under a hypervisor.
>>
>> Cheers,
>> Longman
> Yes. How could we detect that we run under a hypervisor portably? There's
> a flag X86_FEATURE_HYPERVISOR, but it's x86-only.
Right, that will be for x86 only. There is also a kernel boot command
line parameter "workqueue.default_affinity_scope=" that one can use to
set the default. It will be a bit easier to use than changing sysfs
parameter at run time.
Cheers,
Longman
next prev parent reply other threads:[~2024-06-30 14:35 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-29 18:15 Mikulas Patocka
2024-06-29 18:29 ` Waiman Long
2024-06-30 9:49 ` Mikulas Patocka
2024-06-30 14:35 ` Waiman Long [this message]
2024-06-30 17:13 ` Tejun Heo
2024-06-30 18:49 ` Mikulas Patocka
2024-07-01 12:48 ` Michal Prívozník
2024-07-01 13:25 ` Daniel P. Berrangé
2024-07-01 13:40 ` Mikulas Patocka
2024-07-01 13:08 ` Daniel P. Berrangé
2024-07-01 13:42 ` Mikulas Patocka
2024-07-01 13:52 ` Daniel P. Berrangé
2024-07-01 17:25 ` Tejun Heo
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=4bad11b8-b257-44de-87a5-cf428eaa9a64@redhat.com \
--to=longman@redhat.com \
--cc=dm-devel@lists.linux.dev \
--cc=gmazyland@gmail.com \
--cc=jbrassow@redhat.com \
--cc=jiangshanlai@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=loberman@redhat.com \
--cc=minlei@redhat.com \
--cc=mpatocka@redhat.com \
--cc=okozina@redhat.com \
--cc=snitzer@kernel.org \
--cc=tj@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
all inboxes | Powered by JetHome®