Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp6745172rwi; Mon, 24 Oct 2022 05:42:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6KLYhtuKkU2VILT48YhUNNRSFfw7+3pFsy3eOY9nZ5XBAOUxseAjl/yy8ZkhPyxGxUg0u7 X-Received: by 2002:a17:90b:1e0c:b0:20f:bcbf:ab5 with SMTP id pg12-20020a17090b1e0c00b0020fbcbf0ab5mr36730768pjb.187.1666615322701; Mon, 24 Oct 2022 05:42:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615322; cv=none; d=google.com; s=arc-20160816; b=M+7+37FfS/aLcKuN+dKe2JvAlQKH2xNd8l4pTaVC+fCY+rytqYrIhPXpRTF4yDhNOA 5cd6aOhJ51Rz26u9U4tM4chFgJ/4I7P5ShshbVye+ZqJ3TOKczvgeeFO9Ht2oHfANSvr Bef5VPmMMcZkuWLsqvCCwHkcDqJt1mU7FdQDEnVXzOWrIZ+7EQKWxJIPZfP07w/WDP3D ONWd1Yrb1mJCYr1y+8+rDtRU++PVdNC6uYC9QXKnnAlAHVMu434yqoYKvKq674Vy8O31 1leWT2/GTt3+9tLvW3PIOwXdPe3bMlpvElqvcbx/Ylj5YuUhSzCAkCKWX9sOfKMaF2sP w4jA== 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=ypPI7Z/Ek+IYRkw5g5s5ShisnJ2J33Y/QaPI/HQpLPs=; b=IcYhKK4BkUrybn+wKmoALMw01ZashvKbFMHxTps5xrI/VXB3EW20FTNNEuE2FznBRl IBD4U5wwPs7HB9kjmfnXCPlna5EX/R4ZeezojCGiAx8q707pN9rHPF8fhxnhlpQMg0/v ESA+YoNbGmnH7Gs+G105H35Cpvp8T/3Y6B97oVXZs1h3AqPngQReC94MDrFfIJdAiaDa 1pRB0qSwGSPIseHMNFvnzwZb2j7riTsyElvm+4fz2ELe+BLrFMdC5U3KrLPcwzoxv1mh Mxda4IvnrsgLXVFybD/CwD59kIPG6GPbPkw8vawo0MdUu3eN3H2qJsLXfuGw1z3U04pz yoiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=K1gmKTe4; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oj17-20020a17090b4d9100b002132abf9ad6si874034pjb.148.2022.10.24.05.41.47; Mon, 24 Oct 2022 05:42:02 -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=K1gmKTe4; 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 S233199AbiJXMWS (ORCPT + 99 others); Mon, 24 Oct 2022 08:22:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233593AbiJXMTy (ORCPT ); Mon, 24 Oct 2022 08:19:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9A8A7B5B4; Mon, 24 Oct 2022 04:58:36 -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 dfw.source.kernel.org (Postfix) with ESMTPS id A8D966127D; Mon, 24 Oct 2022 11:49:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3A3DC433C1; Mon, 24 Oct 2022 11:49:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612163; bh=dBiRJ7Z5DK4pS3+FNHCtk/Uheq2qnwB5CDfuBuAOSfw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K1gmKTe49mbamoR9LjV0tgOHAHhDdcNyR/hQ5fezbaSz6PkRSAdOeE8WI8FMjATIW tFtBveP1ChHaRHi0f8ZrHnY2c/6/pOGV0uz28w6cEargroMrXs8w+SYcm/DBhuoT3k olTPWwgOHX9rqOolGfRWGfHhsu9L8OiyXlIqTfl0= 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.14 093/210] vhost/vsock: Use kvmalloc/kvfree for larger packets. Date: Mon, 24 Oct 2022 13:30:10 +0200 Message-Id: <20221024113000.050688897@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 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 c87072217dc0..35f2fbc160a5 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 349311f6d195..9b8f592897ec 100644 --- a/net/vmw_vsock/virtio_transport_common.c +++ b/net/vmw_vsock/virtio_transport_common.c @@ -1075,7 +1075,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); -- 2.35.1