From patchwork Mon Oct 24 11:30:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8777 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430613wru; Mon, 24 Oct 2022 05:41:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6HKlTZc0bx+CdC1e2w/9m40XTbL8+1vrU9MExLf0PB84pPQCWc5d1i1joe+aKuQ1vYyZFK X-Received: by 2002:a63:2f82:0:b0:460:8786:5b91 with SMTP id v124-20020a632f82000000b0046087865b91mr27671387pgv.422.1666615317546; Mon, 24 Oct 2022 05:41:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615317; cv=none; d=google.com; s=arc-20160816; b=l9dRwDudXUtM8kKcrgRE+/hkmt82T8clqJdyPoemFcZU+BTOqDCUjNnLyFdiF11Mlg eu9MCTwOBDmMxiVD84Wyk40Qb5KqiM2VnMXkKlpK8QLMcI0j4a/HwKwBP/qQqqnBoyHC eoTLEF1Dgva3vrS77ynxorBqr+fWDUoHADbwNKLewn76SgvuI6SbWYJ8GZEiT3CkEDcg V0bOkJaqUhqnViyRMY1Q0yfryV3aJfBOkzk1mn6IfnVlNg9JFLJ6IjaieL8sHR1WHbNt 5Ja7Yq6ti4UT5dt320+oRBso4QT7rB0qUt/cfaH4tc9UAs0oMmdqy38MOWoaVC6IM58L E1EQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HXAZ3+lRfchpx3fM+XqkvrXFoNmJJyHJpqDNoDukkec=; b=FdfYTMgtOWibwK1V+SLJRowYI4KFe8RhywomGnZRlEX6AlGA/IbWYmZrDLWyhO7Ij6 OYN1OMMuUQUbeBma+t7y+x3E7QrWbxdQWkju2gl6odx7/xKXrxeBnfyM7aEQDc/T/uqn iKFLHdjqW5FdU7nUt33LO6xllw7cxXzOXUxoYk25naFVuRe8Aj3gt31l66mVJi77oMm0 moSXIoP6VdGgDbhZnI+EOIWxgwoGnKwrJlcriS0eV88WmQh8rRlalLjFJWhuq3GNyiDW Vk8VfoLPjE8EffR4InsfEydNIKDu+z+JrAY1M3YAy5Qz980GBs6erg1TKEziziibBJ/3 IMcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZIfE7ngq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k16-20020a170902c41000b00175449cf6f8si42959024plk.606.2022.10.24.05.41.38; Mon, 24 Oct 2022 05:41:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZIfE7ngq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233939AbiJXMcH (ORCPT + 99 others); Mon, 24 Oct 2022 08:32:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233813AbiJXM27 (ORCPT ); Mon, 24 Oct 2022 08:28:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6E98876AF; Mon, 24 Oct 2022 05:02:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3A3CAB811C0; Mon, 24 Oct 2022 11:59:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8FD87C433D6; Mon, 24 Oct 2022 11:59:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612782; bh=irIg9TWHMKH0K5bKYHLrIkzN3v9Q+kmJJ856slhHmH4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZIfE7ngqmwUxr8qu1+yvyfSy5uofIieCYPADCysCt2WB9Kbiz61gcE865/nAecZ64 Y2Af7CoRT8gY0/k9DwOI3/J+1+4MGVFCP2huEQni7IJqoS0jlAnTjQzNjCrsRsSWr9 0J6YrE94Od5+9XvMH0J644+nT74b08fIririS9IE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Junichi Uekawa , Stefano Garzarella , "Michael S. Tsirkin" , Jakub Kicinski , Sasha Levin Subject: [PATCH 4.19 086/229] vhost/vsock: Use kvmalloc/kvfree for larger packets. Date: Mon, 24 Oct 2022 13:30:05 +0200 Message-Id: <20221024113001.843034329@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572823381461048?= X-GMAIL-MSGID: =?utf-8?q?1747572823381461048?= From: Junichi Uekawa [ Upstream commit 0e3f72931fc47bb81686020cc643cde5d9cd0bb8 ] When copying a large file over sftp over vsock, data size is usually 32kB, and kmalloc seems to fail to try to allocate 32 32kB regions. vhost-5837: page allocation failure: order:4, mode:0x24040c0 Call Trace: [] dump_stack+0x97/0xdb [] warn_alloc_failed+0x10f/0x138 [] ? __alloc_pages_direct_compact+0x38/0xc8 [] __alloc_pages_nodemask+0x84c/0x90d [] alloc_kmem_pages+0x17/0x19 [] kmalloc_order_trace+0x2b/0xdb [] __kmalloc+0x177/0x1f7 [] ? copy_from_iter+0x8d/0x31d [] vhost_vsock_handle_tx_kick+0x1fa/0x301 [vhost_vsock] [] vhost_worker+0xf7/0x157 [vhost] [] kthread+0xfd/0x105 [] ? vhost_dev_set_owner+0x22e/0x22e [vhost] [] ? flush_kthread_worker+0xf3/0xf3 [] ret_from_fork+0x4e/0x80 [] ? flush_kthread_worker+0xf3/0xf3 Work around by doing kvmalloc instead. Fixes: 433fc58e6bf2 ("VSOCK: Introduce vhost_vsock.ko") Signed-off-by: Junichi Uekawa Reviewed-by: Stefano Garzarella Acked-by: Michael S. Tsirkin Link: https://lore.kernel.org/r/20220928064538.667678-1-uekawa@chromium.org Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/vhost/vsock.c | 2 +- net/vmw_vsock/virtio_transport_common.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c index 9f67717eaf45..08d49f34c785 100644 --- a/drivers/vhost/vsock.c +++ b/drivers/vhost/vsock.c @@ -354,7 +354,7 @@ vhost_vsock_alloc_pkt(struct vhost_virtqueue *vq, return NULL; } - pkt->buf = kmalloc(pkt->len, GFP_KERNEL); + pkt->buf = kvmalloc(pkt->len, GFP_KERNEL); if (!pkt->buf) { kfree(pkt); return NULL; diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c index cbb336f01cf2..449b5261e661 100644 --- a/net/vmw_vsock/virtio_transport_common.c +++ b/net/vmw_vsock/virtio_transport_common.c @@ -1079,7 +1079,7 @@ EXPORT_SYMBOL_GPL(virtio_transport_recv_pkt); void virtio_transport_free_pkt(struct virtio_vsock_pkt *pkt) { - kfree(pkt->buf); + kvfree(pkt->buf); kfree(pkt); } EXPORT_SYMBOL_GPL(virtio_transport_free_pkt);