Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp976515pxp; Wed, 16 Mar 2022 23:12:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKKYiLPcNE2l33898EpAEWvHvLTFp9gtwlQjB4KM0flEdR9/h8H5l4LCc1VZjtJnhy/MS6 X-Received: by 2002:a63:4a09:0:b0:382:597:3d0d with SMTP id x9-20020a634a09000000b0038205973d0dmr1240391pga.18.1647497572904; Wed, 16 Mar 2022 23:12:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647497572; cv=none; d=google.com; s=arc-20160816; b=0qhE1bxXRLQMa80cNuItDM5KvoybGpkU6WxwalW3gPqR9Aqlc1x6u2YjXMSu24GE5R GylwPFppJPfYhTj8pm6rrXbxmF6OHRw2ryB4CIqqmv2OZVEAtE9QFpp00TPnW+REEkdO cjF0NRKylzjpQyltrrHyg8QAZQeUr2j9oyxhWTTgdUwJMU7xrXyyAlXAndNya1diN0aR 0tclsoEHCf4Bk8ydB/UUKnIL+K4YXHYEqtm2W2P7W/5F0+lIRUUD3I7YRWaCh/uS0i+b L9ZhvZBKp2UmPwGuM5EvN53ZOYz7ZGRUUVtBkfWbx7EIcY3F4EQoFUi/q9Nx+MMpOi52 scrg== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=boCPNcm+Ta/qX0NLyMsnNIo11TTG+c91iYl9xPNyaYk=; b=00+Eq4OCwUfupptkKA37gYieRi75PE+e4FSiKmo7kdlY/M4wmSN49JmOPf1Aag3g+s 8RP82Gp9lq8RBhXCEwe+Cz9kmg6GK8PXf6Z8bz4N4N1bobxvL6S5v2IArNAHxdPT2Je9 nkXPgmJ1VXee6qFjzOrMFzuybyGkFVlQW9mLyTXULjYjRmwRc/6EaffTrSXZFHBism7g 3Y9mhamYAhse5tUwQ/+npjeoMkR9NHzj5T2MyBefvZvsaf0D/jvfAoq6TXrOOu2MVA6j APYfNtCWxggjx+XcfOy2rpBseyvvepCjyos0VahDH1eqx5avExbezCKl85ICo5gFpYkj YcwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=L4l3EOB5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id p2-20020a63ab02000000b003816043f018si1235039pgf.525.2022.03.16.23.12.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 23:12:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=L4l3EOB5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1773CDEB97; Wed, 16 Mar 2022 21:56:05 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358512AbiCQDLc (ORCPT + 99 others); Wed, 16 Mar 2022 23:11:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348676AbiCQDL2 (ORCPT ); Wed, 16 Mar 2022 23:11:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7D7921263; Wed, 16 Mar 2022 20:10:12 -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 6AB58B81E03; Thu, 17 Mar 2022 03:10:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9934C340E9; Thu, 17 Mar 2022 03:10:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1647486610; bh=e/PPn60G5qEvsRXD5WUY9tg3EdpolMuM9Bv/C+K34rU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=L4l3EOB59AQyDmd98y4qHgkslq0cCT3+K+qcuB1uA+tc8cRpjsqZfPnwNlrQTxQex VkvswGYJZ1Q0+ez9pNL3gHoW8SlZJw/wHfa56KrUPXkY4oA81jeRxgHhWg2BiJir0w eC7+qmQi0vnHKLYdDVfnFP9n34k0VkIUjTo5Jd26BuafH//wxOerghGXkbNFdrwSRI ohK492lryUn46z/K95UnCMKouyU6AxUDe8XmPoaD92hAObuvhdq5tMnGwNaJt9kbub PiSJndkfjEhQFWNcSwxuPahxGq0gQWzE1fJpmaPL9sYO2xjmvvrbn6+tlkKRIMjy1v YPa/1qXyDL6xw== Date: Wed, 16 Mar 2022 20:10:07 -0700 From: Jakub Kicinski To: =?UTF-8?B?w43DsWlnbw==?= Huguet Cc: davem@davemloft.net, edumazet@google.com, bigeasy@linutronix.de, atenart@kernel.org, imagedong@tencent.com, petrm@nvidia.com, arnd@arndb.de, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, michael.chan@broadcom.com, Siva Reddy Kallam , Prashant Sreedharan , Rasesh Mody , Sunil Goutham , Raju Rangoju , Ajit Khaparde , Sriharsha Basavapatna , Somnath Kotur , Chris Lee , Jon Mason , Simon Horman , Ariel Elior , Manish Chopra , Jose Abreu Subject: Re: [PATCH net-next] net: set default rss queues num to physical cores / 2 Message-ID: <20220316201007.41aeb5f7@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: <20220315091832.13873-1-ihuguet@redhat.com> References: <20220315091832.13873-1-ihuguet@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 On Tue, 15 Mar 2022 10:18:32 +0100 =C3=8D=C3=B1igo Huguet wrote: > Network drivers can call to netif_get_num_default_rss_queues to get the > default number of receive queues to use. Right now, this default number > is min(8, num_online_cpus()). >=20 > Instead, as suggested by Jakub, use the number of physical cores divided > by 2 as a way to avoid wasting CPU resources and to avoid using both CPU > threads, but still allowing to scale for high-end processors with many > cores. >=20 > As an exception, select 2 queues for processors with 2 cores, because > otherwise it won't take any advantage of RSS despite being SMP capable. >=20 > Tested: Processor Intel Xeon E5-2620 (2 sockets, 6 cores/socket, 2 > threads/core). NIC Broadcom NetXtreme II BCM57810 (10GBps). Ran some > tests with `perf stat iperf3 -R`, with parallelisms of 1, 8 and 24, > getting the following results: > - Number of queues: 6 (instead of 8) > - Network throughput: not affected > - CPU usage: utilized 0.05-0.12 CPUs more than before (having 24 CPUs > this is only 0.2-0.5% higher) > - Reduced the number of context switches by 7-50%, being more noticeable > when using a higher number of parallel threads. Thanks for following up, Inigo! Heads up for the maintainers of drivers which use netif_get_num_default_rss_queues() today - please note the above -=20 the default number of Rx queues may change for you starting with=20 the 5.18 kernel.