From patchwork Wed Jul 21 14:30:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 12391163 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5EB2C12002 for ; Wed, 21 Jul 2021 14:30:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A3A25611C1 for ; Wed, 21 Jul 2021 14:30:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237349AbhGUNtm (ORCPT ); Wed, 21 Jul 2021 09:49:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231791AbhGUNtj (ORCPT ); Wed, 21 Jul 2021 09:49:39 -0400 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5965C061575 for ; Wed, 21 Jul 2021 07:30:15 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id i94so2430589wri.4 for ; Wed, 21 Jul 2021 07:30:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=LsCZd4JYUlf4DgBXgVbea7RBOXoDbg1vUKFjYIRULao=; b=aRMmcMrQz3DNodcGZGJNIgwPB9ul8Scws6Wh44encugspS+AkIqOs1L5KeTTCR2oCr xm3up+Q1gK1r4UgRJfAUz0oWx54v97ib7+QiXJpg427VUpaTcC+kpFi2/kD7Pi2HuD9n amhCyXF4Un6rMyMpJ7diOOYjlg1OEoudCOCJAHmUH2+Lk8EDjkFIEdZo6zCvF/+FEnum pDNnXX42eNYuz/mqaozaReZ1dbcX5I19N5au4G2LtPAwqeEe/DqaFnJhKhtJjH0Ag/oC S9iAWmdAyeBp8wGcibVN1oM45ePOc9cSysgEkLqnvI5ihNEyG+lZ2phdaums+IGcpXAw ALBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=LsCZd4JYUlf4DgBXgVbea7RBOXoDbg1vUKFjYIRULao=; b=sVCz5pheiW6HcTxCltk7bPIyY6hm9+6JeWULMN/UMpjnjq24xSSad5ZNssqZrZSmSI ogiY1dINtd0o+hzkWPycYUc2SFC2rAehm9vQh/ftQJBFT/Ai70qxZCQdpFLYAUhMcjeh EkEDnwOiDlmTQ3TgLLPPZuNxzkg0N7WDMsEObmb7Coy/AkjALV46GdtrveY1UuPqeyMi 1lO/5T7x1jHrS3DgbRRFbSVCZpxsVVSc4w3zwGyokhLWbBZX2OOmTpke6jU4crYGcmHC Wun4oHtZSxyi+qxwo9ecNaUKxhQ+AY1zaac+IdWr+gthwK4nTah0gWepns5MUyYEh03k G6bA== X-Gm-Message-State: AOAM530wqRv9POvFZA/wej5lvh5R06Jgwc41uIIKwnm7RNHG3H+KS91o /7HewSkTbOGCCONQTGg8NsK03/N1FiEJOw== X-Google-Smtp-Source: ABdhPJy+FE5eryA5W6yWBtAOKXEQABDp/4ZN/cKYH6WivHT4TnZA/3j3HuxrxR7/mHKgfaB1peeREg== X-Received: by 2002:adf:f149:: with SMTP id y9mr42188978wro.85.1626877814260; Wed, 21 Jul 2021 07:30:14 -0700 (PDT) Received: from localhost.localdomain ([31.124.24.141]) by smtp.gmail.com with ESMTPSA id 19sm133900wmj.2.2021.07.21.07.30.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jul 2021 07:30:13 -0700 (PDT) From: Lee Jones To: lee.jones@linaro.org Cc: linux-kernel@vger.kernel.org, Ram Muthiah , "Michael S. Tsirkin" , Jason Wang , Stefan Hajnoczi , Stefano Garzarella , "David S. Miller" , Jakub Kicinski , virtualization@lists.linux-foundation.org, kvm@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH 1/1] virtio/vsock: Make vsock virtio packet buff size configurable Date: Wed, 21 Jul 2021 15:30:00 +0100 Message-Id: <20210721143001.182009-1-lee.jones@linaro.org> X-Mailer: git-send-email 2.32.0.402.g57bb445576-goog MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Ram Muthiah After a virtual device has been running for some time, the SLAB sustains ever increasing fragmentation. Contributing to this fragmentation are the virtio packet buffer allocations which are a drain on 64Kb compound pages. Eventually these can't be allocated due to fragmentation. To enable successful allocations for this packet buffer, the packet buffer's size needs to be reduced. In order to enable a reduction without impacting current users, this variable is being exposed as a command line parameter. Cc: "Michael S. Tsirkin" Cc: Jason Wang Cc: Stefan Hajnoczi Cc: Stefano Garzarella Cc: "David S. Miller" Cc: Jakub Kicinski Cc: virtualization@lists.linux-foundation.org Cc: kvm@vger.kernel.org Cc: netdev@vger.kernel.org Signed-off-by: Ram Muthiah Signed-off-by: Lee Jones --- include/linux/virtio_vsock.h | 4 +++- net/vmw_vsock/virtio_transport_common.c | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/linux/virtio_vsock.h b/include/linux/virtio_vsock.h index 35d7eedb5e8e4..8c77d60a74d34 100644 --- a/include/linux/virtio_vsock.h +++ b/include/linux/virtio_vsock.h @@ -7,9 +7,11 @@ #include #include +extern uint virtio_transport_max_vsock_pkt_buf_size; + #define VIRTIO_VSOCK_DEFAULT_RX_BUF_SIZE (1024 * 4) #define VIRTIO_VSOCK_MAX_BUF_SIZE 0xFFFFFFFFUL -#define VIRTIO_VSOCK_MAX_PKT_BUF_SIZE (1024 * 64) +#define VIRTIO_VSOCK_MAX_PKT_BUF_SIZE virtio_transport_max_vsock_pkt_buf_size enum { VSOCK_VQ_RX = 0, /* for host to guest data */ diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c index 169ba8b72a630..d0d913afec8b6 100644 --- a/net/vmw_vsock/virtio_transport_common.c +++ b/net/vmw_vsock/virtio_transport_common.c @@ -26,6 +26,10 @@ /* Threshold for detecting small packets to copy */ #define GOOD_COPY_LEN 128 +uint virtio_transport_max_vsock_pkt_buf_size = 1024 * 64; +module_param(virtio_transport_max_vsock_pkt_buf_size, uint, 0444); +EXPORT_SYMBOL_GPL(virtio_transport_max_vsock_pkt_buf_size); + static const struct virtio_transport * virtio_transport_get_ops(struct vsock_sock *vsk) {