Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp3039632pxb; Tue, 12 Jan 2021 05:02:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJz/yoXKNxvq1YGhjCjyw2G2cUFTN1jDmNx+KodtmzaL/sDWD70LwucEfA8ooKs9gXnDTvks X-Received: by 2002:a17:906:94c5:: with SMTP id d5mr3027338ejy.427.1610456541731; Tue, 12 Jan 2021 05:02:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610456541; cv=none; d=google.com; s=arc-20160816; b=VkS0/OviUawj5/CBJ0s3QktBGnRjC+PgszEvk2nQxAzH2b23AB1L5JgoMxqfVnZGVy W4VmVthY8XvUk6ibVTMC/31b6y/GZy9NcYIONm3S/sRhiV9+cmKJzeePYgT7uP6e93F2 b8MHnPVCML0JKTLoMEQXhtocxlgdk0NH3RuIWUeBu1rn2mSm+nV6nVkdJ2c3PZaL04/L OszEx6D1wteRX2/Zx5Tf2Q6ibUPJYo2n0rcUGHa+v6IlUzcbWc3Hal0aAoOBBnupqwxv dZfOPwAJIrvS7YW8lZgpB1DgwUpy/ydIHgydTQdRQIGcyUeTNetlX7MCgJoX72CwJV5R lI1Q== 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:reply-to:cc:from:to :dkim-signature:date; bh=o4WjqD8WRsgGX3zA0kQjiOkl+6TXdpW90sXH0o/3bao=; b=CvShqmFg0UbQjXP8UHMvQNcdgnS492TTOjRt3BQiWDGkdNodMfYNxAVQ0oabL7sNzi A28euw0v3mOcJIjN7rZK5nE2/roM98F0BOHkzo/RObYrckKp01Nn9vQkI0wqolTPD2MY zrza1eO3tq1gOLQqgMwCK5I41z+HyLF/8XIGjYPBUrNU+JPxu2fNVAaetsyhgXdQlWxp aThUyBJ+kWDSo8DkY81099+hlwu+c6Q2adUitRCL+LY8gcsvATDCmFV4u6AqrsB8Mad3 gej7xq7ijKEll/YpMBE6H7OUJU/SEJwegBU6L7tiB3iogl697gx9kDooTFgmi43AxLAV MmxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail header.b="mpXD/HtG"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mm17si1142238ejb.131.2021.01.12.05.01.57; Tue, 12 Jan 2021 05:02:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail header.b="mpXD/HtG"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728898AbhALK5E (ORCPT + 99 others); Tue, 12 Jan 2021 05:57:04 -0500 Received: from mail-40133.protonmail.ch ([185.70.40.133]:58637 "EHLO mail-40133.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725922AbhALK5D (ORCPT ); Tue, 12 Jan 2021 05:57:03 -0500 Date: Tue, 12 Jan 2021 10:56:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail; t=1610448975; bh=o4WjqD8WRsgGX3zA0kQjiOkl+6TXdpW90sXH0o/3bao=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=mpXD/HtGnvzYArAWrxjXJJC6+7EgBZTl4SI5oarD8YmnknRdQ+vrY3gRp6AQdaUHY Eh8KFg8WnJg0Mpsv7OUGKokRP1CSj5arakiy47gN6YjJVgxPgUYNhFk76nJ5ykwUMG +6tjYUIvWEXzS9jmtf8MBVsc9KKYPJsy3wyznQxmH4YnuRSbmL7GjHUV5YhSORarh7 JBfDQzq8jkWok3U67UA4H3b7aS+iZiCosw/h7oPNM0u32dSwJs5/KaFNG1pPDQJPXa sF46v1qJO0+OzKzC/IDGUFEhdGSesX6P0wMquQqx7/h5CVeyQaxkr4WHzdceuO86DU It+dsY+WdgkpA== To: Eric Dumazet From: Alexander Lobakin Cc: Alexander Lobakin , "David S. Miller" , Jakub Kicinski , Edward Cree , Jonathan Lemon , Willem de Bruijn , Miaohe Lin , Steffen Klassert , Guillaume Nault , Yadu Kishore , Al Viro , netdev , LKML Reply-To: Alexander Lobakin Subject: Re: [PATCH net-next 0/5] skbuff: introduce skbuff_heads bulking and reusing Message-ID: <20210112105529.3592-1-alobakin@pm.me> In-Reply-To: References: <20210111182655.12159-1-alobakin@pm.me> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=10.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on mailout.protonmail.ch Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Eric Dumazet Date: Tue, 12 Jan 2021 09:20:39 +0100 > On Mon, Jan 11, 2021 at 7:27 PM Alexander Lobakin wrote: >> >> Inspired by cpu_map_kthread_run() and _kfree_skb_defer() logics. >> >> Currently, all sorts of skb allocation always do allocate >> skbuff_heads one by one via kmem_cache_alloc(). >> On the other hand, we have percpu napi_alloc_cache to store >> skbuff_heads queued up for freeing and flush them by bulks. >> >> We can use this struct to cache and bulk not only freeing, but also >> allocation of new skbuff_heads, as well as to reuse cached-to-free >> heads instead of allocating the new ones. >> As accessing napi_alloc_cache implies NAPI softirq context, do this >> only for __napi_alloc_skb() and its derivatives (napi_alloc_skb() >> and napi_get_frags()). The rough amount of their call sites are 69, >> which is quite a number. >> >> iperf3 showed a nice bump from 910 to 935 Mbits while performing >> UDP VLAN NAT on 1.2 GHz MIPS board. The boost is likely to be >> way bigger on more powerful hosts and NICs with tens of Mpps. > > What is the latency cost of these bulk allocations, and for TCP traffic > on which GRO is the norm ? > > Adding caches is increasing cache foot print when the cache is populated. > > I wonder if your iperf3 numbers are simply wrong because of lack of > GRO in this UDP VLAN NAT case. Ah, I should've mentioned that I use UDP GRO Fraglists, so these numbers are for GRO. My board gives full 1 Gbps (link speed) for TCP for more than a year, so I can't really rely on TCP passthrough to measure the gains or regressions. > We are adding a log of additional code, thus icache pressure, that > iperf3 tests can not really measure. Not sure if MIPS arch can provide enough debug information to measure icache pressure, but I'll try to catch this. > Most linus devices simply handle one packet at a time (one packet per int= errupt) I disagree here, most modern NICs usually handle thousands of packets per single interrupt due to NAPI, hardware interrupt moderation and so on, at least in cases with high traffic load. Al