From: Joe Jin <joe.jin@oracle.com>
To: Jason Wang <jasowang@redhat.com>,
Dongli Zhang <dongli.zhang@oracle.com>,
virtualization@lists.linux-foundation.org, kvm@vger.kernel.org,
netdev@vger.kernel.org, James Bottomley <jejb@linux.ibm.com>
Cc: linux-kernel@vger.kernel.org, mst@redhat.com,
pbonzini@redhat.com, stefanha@redhat.com,
aruna.ramakrishna@oracle.com
Subject: Re: [PATCH v2 1/1] vhost scsi: alloc vhost_scsi with kvzalloc() to avoid delay
Date: Mon, 1 Feb 2021 08:03:08 -0800 [thread overview]
Message-ID: <7f9c745b-6944-ab6c-e231-ae0c55687c6d@oracle.com> (raw)
In-Reply-To: <61ed58d6-052b-9065-361d-dc6010fc91ef@redhat.com>
Can anyone help to review this patch and give a review-by for it please?
Thanks,
Joe
On 1/24/21 7:12 PM, Jason Wang wrote:
>
> On 2021/1/23 下午4:08, Dongli Zhang wrote:
>> The size of 'struct vhost_scsi' is order-10 (~2.3MB). It may take long time
>> delay by kzalloc() to compact memory pages by retrying multiple times when
>> there is a lack of high-order pages. As a result, there is latency to
>> create a VM (with vhost-scsi) or to hotadd vhost-scsi-based storage.
>>
>> The prior commit 595cb754983d ("vhost/scsi: use vmalloc for order-10
>> allocation") prefers to fallback only when really needed, while this patch
>> allocates with kvzalloc() with __GFP_NORETRY implicitly set to avoid
>> retrying memory pages compact for multiple times.
>>
>> The __GFP_NORETRY is implicitly set if the size to allocate is more than
>> PAGE_SZIE and when __GFP_RETRY_MAYFAIL is not explicitly set.
>>
>> Cc: Aruna Ramakrishna <aruna.ramakrishna@oracle.com>
>> Cc: Joe Jin <joe.jin@oracle.com>
>> Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
>> ---
>> Changed since v1:
>> - To combine kzalloc() and vzalloc() as kvzalloc()
>> (suggested by Jason Wang)
>>
>> drivers/vhost/scsi.c | 9 +++------
>> 1 file changed, 3 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
>> index 4ce9f00ae10e..5de21ad4bd05 100644
>> --- a/drivers/vhost/scsi.c
>> +++ b/drivers/vhost/scsi.c
>> @@ -1814,12 +1814,9 @@ static int vhost_scsi_open(struct inode *inode, struct file *f)
>> struct vhost_virtqueue **vqs;
>> int r = -ENOMEM, i;
>> - vs = kzalloc(sizeof(*vs), GFP_KERNEL | __GFP_NOWARN | __GFP_RETRY_MAYFAIL);
>> - if (!vs) {
>> - vs = vzalloc(sizeof(*vs));
>> - if (!vs)
>> - goto err_vs;
>> - }
>> + vs = kvzalloc(sizeof(*vs), GFP_KERNEL);
>> + if (!vs)
>> + goto err_vs;
>> vqs = kmalloc_array(VHOST_SCSI_MAX_VQ, sizeof(*vqs), GFP_KERNEL);
>> if (!vqs)
>
>
> Acked-by: Jason Wang <jasowang@redhat.com>
>
>
>
next prev parent reply other threads:[~2021-02-01 16:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-23 8:08 [PATCH v2 1/1] vhost scsi: alloc vhost_scsi with kvzalloc() to avoid delay Dongli Zhang
2021-01-23 20:14 ` Dongli Zhang
2021-01-25 3:12 ` Jason Wang
2021-02-01 16:03 ` Joe Jin [this message]
2021-02-02 14:56 ` Pankaj Gupta
2021-02-07 3:03 ` [vdpa_sim_net] 79991caf52: net/ipv4/ipmr.c:#RCU-list_traversed_in_non-reader_section kernel test robot
2021-02-07 20:15 ` Dongli Zhang
2021-02-08 16:10 ` Joe Jin
2021-03-18 6:31 ` Oliver Sang
2021-02-08 9:57 ` Michael S. Tsirkin
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=7f9c745b-6944-ab6c-e231-ae0c55687c6d@oracle.com \
--to=joe.jin@oracle.com \
--cc=aruna.ramakrishna@oracle.com \
--cc=dongli.zhang@oracle.com \
--cc=jasowang@redhat.com \
--cc=jejb@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pbonzini@redhat.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;
as well as URLs for NNTP newsgroup(s).