Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp3039847pxb; Tue, 12 Jan 2021 05:02:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJxdGT3Cx7IWDfPTt3lwc57NoejQrWMWOC6gq8bbelo8j14e3gf0Awm+rpZnLjGCD1mYRY1u X-Received: by 2002:a50:fc8b:: with SMTP id f11mr3347555edq.11.1610456555973; Tue, 12 Jan 2021 05:02:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610456555; cv=none; d=google.com; s=arc-20160816; b=Evt+5ebVh76E/zGQEI47cUQI7rMdDuENV+AZu0Pgb4kwsBc9aeTF5lOVH810Gb1Whs 0XpeLBm8YGb31Nu7yz3a/gEKQhgdIQkE67BrZ7NCIqTEu7iipVg854TLbpjI5szrsxMd r/rydzOAKpQUtZmgpTmVlwC2P8rC2pr0KekpDbkAv+G0PbTRw3PLjE/OhiRC3EmmR1aw RgcIZDnkruxx2duANSpRVxlgyYLFkmOwwHI6iL6KPwRtICH0D7S5gvg+utBvFqG6U8wG L3MYKSmqTbeRkdSxJvidKw6WdcyuVedp5BBrTWZPdVkD/q+f10klNaMVRjp1vSbaZeF/ kOYA== 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=9Pj0YAwWv/zYIG9LK/XF1RnE+W2Pai5Bl/8RQ1TEw0g=; b=B7CW1d4b7CxXvPfr6ahEkmro5/sbfXjZ2WJdIumex8rMwrLbbskZfSJtN2SqiGd5oY yjJy09JruZNRZ10AKt+XjQ7/AbGlWDMMn8OdgIvij4ckT6iIr2DcEk/Kf7MfJT+wiDXm qdqMTch6edWNPJAQulI0XZS4xXUCiqb/c5wICizSjd00xZ+GK74E39qwBKaDYb0vZSJF Mu/VtxX5h/32tM6LfYT2PWhlRC2qTR1pAsN09IiteRrlzCBJXYmltlnvVZVM5/YcihJb JZUne/KclNJW356++WT6P3lvonxcLFqinDTxXwjHmd3E5M/z0dkNjII5vufj+J+Fr/Tm t5zA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail header.b=YVqimRxG; 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 bu21si1334846edb.199.2021.01.12.05.02.11; Tue, 12 Jan 2021 05:02:35 -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=YVqimRxG; 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 S2390883AbhALLJ1 (ORCPT + 99 others); Tue, 12 Jan 2021 06:09:27 -0500 Received: from mail-40131.protonmail.ch ([185.70.40.131]:21307 "EHLO mail-40131.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732036AbhALLJZ (ORCPT ); Tue, 12 Jan 2021 06:09:25 -0500 Date: Tue, 12 Jan 2021 11:08:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail; t=1610449723; bh=9Pj0YAwWv/zYIG9LK/XF1RnE+W2Pai5Bl/8RQ1TEw0g=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=YVqimRxGmPdGr1qE4VwCnwpP3KC1lGN44f6RR5Rm2gF5aYeTlgz6C25GwT2Nt6+Gz tBvSsfkIdiXvniE6xTsuRJvpcv9t0srAcdVwO3h1gcQmDsG/TjEunpMCUNAVlndxPD kaJU+DgcktAQPBNy7ukifvHAxLGrzDPQCSj+KpRab6WG10vfBcxcvEevW4Rkv4wXwG DVi2ZlzxJYcEPD5sEokuQFEu2BagdGxkXfW9seZwp9R1z5CqQhW0g+08YbjB5qDwaC PIvn4vXoK6UM/w+N1IlZ5k/KOBXjTxu+URBOQcBzN+ArRkLoQLW5o5mrcpl0JMGMV0 GYLqdaj7AYRCg== To: Edward Cree From: Alexander Lobakin Cc: Alexander Lobakin , "David S. Miller" , Jakub Kicinski , Eric Dumazet , Edward Cree , Jonathan Lemon , Willem de Bruijn , Miaohe Lin , Steffen Klassert , Guillaume Nault , Yadu Kishore , Al Viro , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Reply-To: Alexander Lobakin Subject: Re: [PATCH net-next 0/5] skbuff: introduce skbuff_heads bulking and reusing Message-ID: <20210112110802.3914-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: Edward Cree Date: Tue, 12 Jan 2021 09:54:04 +0000 > Without wishing to weigh in on whether this caching is a good idea... Well, we already have a cache to bulk flush "consumed" skbs, although kmem_cache_free() is generally lighter than kmem_cache_alloc(), and a page frag cache to allocate skb->head that is also bulking the operations, since it contains a (compound) page with the size of min(SZ_32K, PAGE_SIZE). If they wouldn't give any visible boosts, I think they wouldn't hit mainline. > Wouldn't it be simpler, rather than having two separate "alloc" and "flus= h" > caches, to have a single larger cache, such that whenever it becomes ful= l > we bulk flush the top half, and when it's empty we bulk alloc the bottom > half? That should mean fewer branches, fewer instructions etc. than > having to decide which cache to act upon every time. I though about a unified cache, but couldn't decide whether to flush or to allocate heads and how much to process. Your suggestion answers these questions and generally seems great. I'll try that one, thanks! > -ed Al