Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4108864rwl; Tue, 28 Mar 2023 02:45:06 -0700 (PDT) X-Google-Smtp-Source: AKy350ZeaIA5qSKaSO/Vl7s6V0mFC6fLaUopky8mTlqgupF5QnontX60/Hzjni2N144VUHxhW1ar X-Received: by 2002:a17:906:9756:b0:932:9303:76b9 with SMTP id o22-20020a170906975600b00932930376b9mr17833687ejy.26.1679996705812; Tue, 28 Mar 2023 02:45:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679996705; cv=none; d=google.com; s=arc-20160816; b=Zwrb4ySZGR99P9Vjrxa3eHzXg+iujlSrQdtsioi1Y3BRMKUkVNogkGV0jN9/SRquvj O2P/niRuUag0Hs3SBMgV2GTf7UXTxn9dhLFkR5iBkfVBUm1sFDg5Ew9do8rJvHj/PgFK g26m5Y3vdnlgcDgQCcmLG1l81gEKbhF2l/fnlBxJmsROHsWiy+76fAPByHyhp7KNsyYw 8VNoF5+W8Nbaf2a1nU1KdAbdc3UrbcLVHtsc2T+mKRIgP3s7Lp/9B/zj+PLTLqvgOX+e pOzW87hKTgoYZzb0ZsS+QV/nfpFg9j6jPbHj1NJ+qQOsxVoEDjW32OcFT+jzWnSh4Bw8 UMMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=fw+UNgg8tbQKJQVmaoiT613D8teaf+aPc3V9zje+IMk=; b=hGoD7s/YRJjAlNxVs9CKSfSb8G6GJka2QT5tjv94QNlVJMWCVq3Z23GawJOlIuypIJ 41VVUVUzry5vh+zjcGx3e0kC/oLzFBfyut9gp3cRcTWhkcs/XpW4n66eoW0byXpSC4Ib xNtsLeXK3I5SS5cYK/szWnAL/8kq3c5ufsb3Ln2gw+ZE/hp5tyQOhAeDvwP9sLi7gPFC lgC7E1dCD3SwfBN72zCuyfT+jBzftBdd5XaZ/83JMTDSRouhPy/C+ajWR4/xG9pqytH9 SYQAZtkDEO3jcHM6EAiO+/VzVBpjTIbo0uUfgcaxSFLbX7AZQZGaUeJjBC7vVVsz/lKo 72TQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=I5opOQrp; 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=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ne36-20020a1709077ba400b0093d4fb59d99si15052248ejc.422.2023.03.28.02.44.39; Tue, 28 Mar 2023 02:45:05 -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=@redhat.com header.s=mimecast20190719 header.b=I5opOQrp; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232840AbjC1Jdi (ORCPT + 99 others); Tue, 28 Mar 2023 05:33:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232537AbjC1JdT (ORCPT ); Tue, 28 Mar 2023 05:33:19 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 026B186B9 for ; Tue, 28 Mar 2023 02:30:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679995770; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fw+UNgg8tbQKJQVmaoiT613D8teaf+aPc3V9zje+IMk=; b=I5opOQrpGw94Zk4iG0DkP/Z3AnCuE7i+IDSFyniYD6hztRg0Ix2gSPop/LjOU0malFqvH8 vTiCMPvw94ta3vklGap9dWkn7JB+6i59iVdxL1bkr72Ib2T9rPjy4GfyV8bu1wTptREBWy z5EwuElvI/b8fyd8G5lOwCGvu4DI11A= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-258-rlskD8sIPSS55E4BDt7T6A-1; Tue, 28 Mar 2023 05:29:28 -0400 X-MC-Unique: rlskD8sIPSS55E4BDt7T6A-1 Received: by mail-qv1-f69.google.com with SMTP id pr2-20020a056214140200b005b3ed9328a3so4758267qvb.10 for ; Tue, 28 Mar 2023 02:29:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679995768; x=1682587768; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=fw+UNgg8tbQKJQVmaoiT613D8teaf+aPc3V9zje+IMk=; b=AkjgG8LXC6OvsqoEmui+CkiK+cCxJfMcsEt8U8AR3rClx2bBKwN18lRkPT/NcSLX3v B040SkrtD3UTxMahi8k2mlK22RiMLngac0iLgvq8/CXf2pW71yost3GpKe2mkg3f+SGw UAtERdNDgy/2q03FKSxdpoW8aDAkosuyMziVZao7JUaRnbc4b0ogLuNxvTe9+vuSH4wv RjKVFt2fPkdX6sagkqtI0Aky6b2jxul9GatSJj76Vt8oXAL7a+0sMNxvetCUhg3O9YVa Kol6DKRAOCC7zZ8YD/ty8K3cBxWgCmDyf8I4lrReg1hT/qz+PB4rtMbHvazB9UUOYoC6 RtaA== X-Gm-Message-State: AAQBX9diu8BAwIp/B4wmXMq2BqwLgMFZkNyzwvzijCvf4xqppQ8x1aj+ WmtsfhWZKwQw6qAOobRdZsgLG4G0XHj4kFfBWyMoFpxRXAaZxJHa8io/H7jQV45EaPvcp7yzFZA e9p6y9Yb1IlkrxW+o8HKECylo X-Received: by 2002:ad4:5c82:0:b0:59b:920e:1f9a with SMTP id o2-20020ad45c82000000b0059b920e1f9amr23301364qvh.2.1679995768419; Tue, 28 Mar 2023 02:29:28 -0700 (PDT) X-Received: by 2002:ad4:5c82:0:b0:59b:920e:1f9a with SMTP id o2-20020ad45c82000000b0059b920e1f9amr23301349qvh.2.1679995768123; Tue, 28 Mar 2023 02:29:28 -0700 (PDT) Received: from gerbillo.redhat.com (146-241-232-148.dyn.eolo.it. [146.241.232.148]) by smtp.gmail.com with ESMTPSA id lx12-20020a0562145f0c00b005dd8b9345bdsm3621117qvb.85.2023.03.28.02.29.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Mar 2023 02:29:27 -0700 (PDT) Message-ID: <751fd5bb13a49583b1593fa209bfabc4917290ae.camel@redhat.com> Subject: Re: [PATCH net-next] net/core: add optional threading for backlog processing From: Paolo Abeni To: Felix Fietkau , Jakub Kicinski Cc: netdev@vger.kernel.org, Jonathan Corbet , "David S. Miller" , Eric Dumazet , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Date: Tue, 28 Mar 2023 11:29:24 +0200 In-Reply-To: References: <20230324171314.73537-1-nbd@nbd.name> <20230324102038.7d91355c@kernel.org> <2d251879-1cf4-237d-8e62-c42bb4feb047@nbd.name> <20230324104733.571466bc@kernel.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.4 (3.46.4-1.fc37) MIME-Version: 1.0 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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 Fri, 2023-03-24 at 18:57 +0100, Felix Fietkau wrote: > On 24.03.23 18:47, Jakub Kicinski wrote: > > On Fri, 24 Mar 2023 18:35:00 +0100 Felix Fietkau wrote: > > > I'm primarily testing this on routers with 2 or 4 CPUs and limited= =20 > > > processing power, handling routing/NAT. RPS is typically needed to= =20 > > > properly distribute the load across all available CPUs. When there is= =20 > > > only a small number of flows that are pushing a lot of traffic, a sta= tic=20 > > > RPS assignment often leaves some CPUs idle, whereas others become a= =20 > > > bottleneck by being fully loaded. Threaded NAPI reduces this a bit, b= ut=20 > > > CPUs can become bottlenecked and fully loaded by a NAPI thread alone. > >=20 > > The NAPI thread becomes a bottleneck with RPS enabled? >=20 > The devices that I work with often only have a single rx queue. That can > easily become a bottleneck. >=20 > > > Making backlog processing threaded helps split up the processing work= =20 > > > even more and distribute it onto remaining idle CPUs. > >=20 > > You'd want to have both threaded NAPI and threaded backlog enabled? >=20 > Yes >=20 > > > It can basically be used to make RPS a bit more dynamic and=20 > > > configurable, because you can assign multiple backlog threads to a se= t=20 > > > of CPUs and selectively steer packets from specific devices / rx queu= es=20 > >=20 > > Can you give an example? > >=20 > > With the 4 CPU example, in case 2 queues are very busy - you're trying > > to make sure that the RPS does not end up landing on the same CPU as > > the other busy queue? >=20 > In this part I'm thinking about bigger systems where you want to have a > group of CPUs dedicated to dealing with network traffic without > assigning a fixed function (e.g. NAPI processing or RPS target) to each > one, allowing for more dynamic processing. >=20 > > > to them and allow the scheduler to take care of the rest. > >=20 > > You trust the scheduler much more than I do, I think :) >=20 > In my tests it brings down latency (both avg and p99) considerably in > some cases. I posted some numbers here: > https://lore.kernel.org/netdev/e317d5bc-cc26-8b1b-ca4b-66b5328683c4@nbd.n= ame/ It's still not 110% clear to me why/how this additional thread could reduce latency. What/which threads are competing for the busy CPU[s]? I suspect it could be easier/cleaner move away the others (non RPS) threads. Cheers, Paolo