Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp79061pxb; Tue, 12 Jan 2021 20:48:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJw7xifhC4Y6+/5E0GqGPg0j4g4WnpBJQBTW0bv6N4rNwzJuFbmGNHrCmr0SmxNmW9ucpgsU X-Received: by 2002:a05:6402:27d1:: with SMTP id c17mr311349ede.109.1610513339502; Tue, 12 Jan 2021 20:48:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610513339; cv=none; d=google.com; s=arc-20160816; b=pJS4noM/xVjIACty4S4q/fm0bJEShM9k3YZw0HxnGMiua5ZgrLBXmkGoCQMWrcWwX6 K0bdCOo8x82av0d/DExEOPlRvBF1NtWmqvFSWen1bP3L4+oq1o2RH4J2WKdc4yu6I6XA tcrgmIXGwXzrFunHo6cJ+sT+WSDp21nua8qjznl+zq/1HWdU0/k8zKA65tz5sgJfG4fV iYeVw4xX3MnGMoEi9CzJqzDwjjJOA97rYD9l49sM+cSS2NrLJB38DcTBTiglEfUDHGVG B0g71xS/CaxLJIQlsnGIEds307TeCodXaTi14tShecVOCqb/T3me4oGJI1UMiXxZH3ra hFaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=tOWy8KhOizbd2Dn5a2Cj2vcBNaHIiB2CBvkXn3Ip+EE=; b=i/8PFL2ZKE/slQTaIUjtsPn6AkAOqVSUrzUJwlau5WQG5Yv4CZGqa55q5OHpipiqFu wm0OEXQn+clUdPcMg6OqYMdLqTVLdDoNO9NUoHYLOS9O5ihGl6vx4hQwX2TqioMRbSQl L0GlWNYqB5YyvVMN5Y1NrKNV3gZj/PSb6bYMtPlfSZe8DBmz166PyEUQXPA/s05IK4fo hhOFk/mfp7Ooaw91u8YvlRffHEVZrqJerJUntlNxWAmWogi+DaqFk1Ta7WwZzHbSWvRf 4UUD3aFFszysBWHFOFvn2N7+utfo3Po/6g2oQjQ7ivLCMt1XT5rp7PNoplz32Bi9vEHV b6aQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=d2NYmxC2; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z6si389964ejr.643.2021.01.12.20.48.35; Tue, 12 Jan 2021 20:48:59 -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=@google.com header.s=20161025 header.b=d2NYmxC2; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725935AbhAMEq7 (ORCPT + 99 others); Tue, 12 Jan 2021 23:46:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725824AbhAMEq6 (ORCPT ); Tue, 12 Jan 2021 23:46:58 -0500 Received: from mail-io1-xd30.google.com (mail-io1-xd30.google.com [IPv6:2607:f8b0:4864:20::d30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B31FC061786 for ; Tue, 12 Jan 2021 20:46:18 -0800 (PST) Received: by mail-io1-xd30.google.com with SMTP id w18so1706913iot.0 for ; Tue, 12 Jan 2021 20:46:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=tOWy8KhOizbd2Dn5a2Cj2vcBNaHIiB2CBvkXn3Ip+EE=; b=d2NYmxC2uL6xEKj/wkCG8Sa3jmX1U1Uj7nFnDywZfdP0ZvKieml5KnAgVwy3X1iNHw v21pdcqXK691gbaofSUUiZQIt367J/hM+bXGAuID6SJmwNZe2KQKflt6imTBloG86oP/ SDGMF8bVPwVW9aFpnNBL0iLeUX6bEo5hQT5ZXJop22oSGZgXIS1qGrYlSpmwjXZ7G+Ng 7528zhJjZn4LNTMp1gMUxmxx5T2bVUpQeWmTC699GvesPVxT794KXGjhy57J+c/25hNA amfiO0H4WuutwudKyx1KU2gYhasQUZEgaWP8iBC80yYn+J+yIOIaeTe3V/EtHGOY4V2d 3N3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=tOWy8KhOizbd2Dn5a2Cj2vcBNaHIiB2CBvkXn3Ip+EE=; b=O7TYsyAIwrS71yf6ffnJdcQ9jgidZGlEUDzJV3dxzEhioolWRjqVtf/OCbJH2xtlSR r9UbHZ6OXCHuigAaEmIlmgO8im7RBBr0Wxw10vr3bwT6G+Wfj5uqe3qPOPm3JHjm71bW MK4IB912SuxDxBfJCtUyZ/3/VhXpTSFvB5Oq3MhsasxqsAvJcPQkkJ38EwhMfAODZR2Q Rmrz7Qkj6wOes3zgxILQ+lkGePH10EF01MwqrEcJP6CV/RNtQbzGAD+H9lfCjOxjrp/F kr1ZAhLUfVnue9dgvCX1pijRaRmvEvjoC4Ka/yxt9OErAz/UpcQc0SyZX8iddYVCZAtG sVqw== X-Gm-Message-State: AOAM5318T3Nud6qVRGJFZBFfGJjlu+KakXXdiQCCcBo0hWYD/FoB4rOX mk+ucF2vWYz5nJCgC6zC1lHwi0wr6BsKXqN7Gt+h/g== X-Received: by 2002:a05:6e02:42:: with SMTP id i2mr582043ilr.68.1610513177471; Tue, 12 Jan 2021 20:46:17 -0800 (PST) MIME-Version: 1.0 References: <20210111182655.12159-1-alobakin@pm.me> <20210112110802.3914-1-alobakin@pm.me> <20210112170242.414b8664@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: <20210112170242.414b8664@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> From: Eric Dumazet Date: Wed, 13 Jan 2021 05:46:05 +0100 Message-ID: Subject: Re: [PATCH net-next 0/5] skbuff: introduce skbuff_heads bulking and reusing To: Jakub Kicinski 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 13, 2021 at 2:02 AM Jakub Kicinski wrote: > > 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 I read the existing code, and with Edward Cree idea of reusing the existing cache (storage of pointers), ths now all makes sense, since there will be not much added code (and new storage of 64 pointers) The remaining issue is to make sure KASAN will still work, we need this to detect old and new bugs. Thanks !