Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp46258pxb; Tue, 12 Jan 2021 19:35:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJyFTUvL0KDBKk58NdpWQuglOC0boEpt6+F2Hxe5ezWRQBRKUX1twBCLizclmEWpoCNCTevP X-Received: by 2002:a17:906:af99:: with SMTP id mj25mr91048ejb.414.1610508936386; Tue, 12 Jan 2021 19:35:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610508936; cv=none; d=google.com; s=arc-20160816; b=MKhVX5LXEuG6TRAG6RkAgwvKW87e0g8SJ8d0fnHuDfPzdCf+Vsq8CttOMDOlb0kjH1 gGRJXD3WvtsHxXZikbg7lFVyBlegSw/JfUoop+cuOwxJcqrxIv6OevqC9Xhm7o1Huvcv j3gifqlAL1KGEt1QmFsowATJktCt8n5kXju5+C5Nyou8KTt2EwLOXltTk8E6o12dcz0y mDmD1KN4/Tg62R5tsVZvy94qsxMnuAPyKrYLygBlXSeI5r6LwiZS6/BYxUyGhe/KJ4LS fib/R5O1bnsenGr/YWlDGXgjXaCHCM4I/3JIZ+KUoOIXDTog10nlhT3xuZlguDY4zf1t MHuw== 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=UyyrM+SxYYYrw4W/0LPVwQicJO0vcudk2Y7WaJGW70c=; b=KYJe4Q2N7dYEnThlDdkfk4+5pzAIaBQjltPoKuG/oBJJEOnvLEHKhnULwFXAQzEWNY 618oPNOp0UVqt8XLj9gNvT0dc7M9y83/jHvC2gPSojtwIpDun/v4WaCI4ODTt7V4RsuG OOg41GNVW6NwOX8MuKaFx8h7prFROV8PINFGrXs4r2OY2PE5/TyCSVTrRa+iPc5ePH2d Ib4TtVfwjDK5/QhYlWLDH/3FJqgzwm51PKtOGPIEZk+s1BmfVPBWpUaYO+8j5F5wDBds vboUYnQeaOpzr74ZYnxoJYRyAynyxNAo/k+zEdMG4QzuR5KcXBDlPfxWLniwk8OExdl5 GmMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=duoxvqWk; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x91si366290ede.370.2021.01.12.19.35.13; Tue, 12 Jan 2021 19:35:36 -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=@kernel.org header.s=k20201202 header.b=duoxvqWk; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726507AbhAMBD0 (ORCPT + 99 others); Tue, 12 Jan 2021 20:03:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:55360 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726468AbhAMBDY (ORCPT ); Tue, 12 Jan 2021 20:03:24 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8BB3D2312E; Wed, 13 Jan 2021 01:02:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1610499764; bh=1ar0eB8cpBDMlvgsTxEJtgHSkcfpvXM3Tv7f3mt2YPU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=duoxvqWkehgc9Nyje3pyd/TGQZY7bi5BQL+O7mnnIpGdeb8amdkM7lT51Fh0KijFw 1wVGsZ9cF9A6lL+MdMM1Va5Ucbnzt2T9ulczKtNDDcsoiJYq+hmhGiKY6GfZM+06xK 4Y71U3onYJlm3xnO86qm4EVP1Im/s15wbKTWN0TT2ChbBLn4F6M29r61H9/yl3366x QORBL3lRE2Sr2VdoP8lIuLKuDXYpZHt8Gw+Ld8EGN2lLvj4CXrl+IH7eBR/1iO/EpL FOJsE2VrIAAXa4VARZ57qT2X6NGcloKx1Q0hpepoOrnDhtZvBUs+BrQrqk3ZHGR9g8 6GSV1XCWPeOkg== Date: Tue, 12 Jan 2021 17:02:42 -0800 From: Jakub Kicinski To: Eric Dumazet Cc: Alexander Lobakin , Edward Cree , "David S. Miller" , Edward Cree , Jonathan Lemon , Willem de Bruijn , Miaohe Lin , Steffen Klassert , Guillaume Nault , Yadu Kishore , Al Viro , netdev , LKML Subject: Re: [PATCH net-next 0/5] skbuff: introduce skbuff_heads bulking and reusing Message-ID: <20210112170242.414b8664@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: References: <20210111182655.12159-1-alobakin@pm.me> <20210112110802.3914-1-alobakin@pm.me> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 12 Jan 2021 13:23:16 +0100 Eric Dumazet wrote: > On Tue, Jan 12, 2021 at 12:08 PM Alexander Lobakin wrote: > > > > 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 "flush" > > > caches, to have a single larger cache, such that whenever it becomes full > > > 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! > > The thing is : kmalloc() is supposed to have batches already, and nice > per-cpu caches. > > This looks like an mm issue, are we sure we want to get over it ? > > I would like a full analysis of why SLAB/SLUB does not work well for > your test workload. +1, it does feel like we're getting into mm territory > More details, more numbers.... before we accept yet another > 'networking optimization' adding more code to the 'fast' path. > > More code means more latencies when all code needs to be brought up in > cpu caches.