Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2477624pxb; Mon, 11 Jan 2021 10:34:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJwdOuNUfXcLikZekVllbRUDq+jSrxDl2OdPq7Y5Xhp/uLczUSqe4zVxJIizFolg1pg4NWWu X-Received: by 2002:a17:906:82ce:: with SMTP id a14mr529971ejy.421.1610390043928; Mon, 11 Jan 2021 10:34:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610390043; cv=none; d=google.com; s=arc-20160816; b=o+DOUHIOsUQPWjGDuumii/I71bgSDLpI+Nud+XAT5Eosid19RPpKkG0tn4LsZcAV9D jezXr1FMrYCRPwxUDhXsvPKkNtSFElmEsHkM2yEEqCIywoGuk4dnFVOfdJltS4y8qQ22 Bv8vJZTWidKzX48pTVuQUB/wTGXAgxgdLAuIXWya4IBjWL2NkgyUduTQPmSmO92sjttH FhadyyFLCX0HndAoriaudrI/nhEmykhRsedbCQ9yWml6ViHRRIJihzYzaAQZ932S9qwi tbZ6AhGuaYRnwoI92zUn6V4arMItuffU0ErH37nT73nF1d68tCQQ+jjCMlvXQCOzxaRe 149w== 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=ed2E3ZDT8/tIMKq0U8JNRKLCBc4eky4hYA4RXRAiMWs=; b=Sk0T9PN7ElxXkECi/4o0N6ZfW9H2MeTlu0xZ1L1xEE2QLtmDSly+ZfGWpjx6WO3QMJ cAbAVgwpxmLDUssER5r4PpTNWF7QHC457vn35AsmMzN+hGxLI/SWxVZUfZiO9o6BVFg0 peXXvkppazHwRA5ozizVKkBDnHGOrnBIfNPZC+na8u4t7Lefz4cu9VSh7Ynsfyr594Xn x1V+6hppweeeCu4MTvLEbc6yI+vCrjskxWSWdqDPiAxim4AYZd0vBm3wQK9wI2Wya3vy CbHHQ6n1Fl3lDxxxgsohB8kBa4tLvp/5xL88GShXNzsjuAvZXUneOHnUlgiik5cbPlk3 TG1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail header.b=XrpbpgkF; 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 z2si219766ede.501.2021.01.11.10.33.39; Mon, 11 Jan 2021 10:34:03 -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=XrpbpgkF; 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 S2390595AbhAKSae (ORCPT + 99 others); Mon, 11 Jan 2021 13:30:34 -0500 Received: from mail-40134.protonmail.ch ([185.70.40.134]:34124 "EHLO mail-40134.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390533AbhAKSac (ORCPT ); Mon, 11 Jan 2021 13:30:32 -0500 Date: Mon, 11 Jan 2021 18:29:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail; t=1610389789; bh=ed2E3ZDT8/tIMKq0U8JNRKLCBc4eky4hYA4RXRAiMWs=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=XrpbpgkFYGY8WwMuHq87QqgNIu7l+lsA2yUPH41gqPBBZh3R/kMs6CFmeinU1Zsr5 z58eX9902Rn+oIxj0Cb/AgwmHkbw/RfKHgK019AIcX7euBUWPADyc5rsXFEjOXcEkR vbRB30hBlfCaiQ5x38bHxwxM3fkR1dCEZGjnWqxtFYSAWIsIWEElj/BbtBZmqMHoIl +XhBUJVawl6/qs0Hs2RrKG/B66moh68B4SuT61suhO0XLQhjlRkuiZLAnIQjyxc0bD wOs4lyl1MI62nGmjE9goqazW3kLnrs8eaRRLtvYkFrrO4646b64vzr64wvozj3vrvo G/PxsoNsEPXUg== To: "David S. Miller" , Jakub Kicinski From: Alexander Lobakin Cc: Eric Dumazet , Edward Cree , Jonathan Lemon , Willem de Bruijn , Miaohe Lin , Alexander Lobakin , Steffen Klassert , Guillaume Nault , Yadu Kishore , Al Viro , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Reply-To: Alexander Lobakin Subject: [PATCH net-next 5/5] skbuff: refill skb_cache early from deferred-to-consume entries Message-ID: <20210111182801.12609-5-alobakin@pm.me> In-Reply-To: <20210111182801.12609-1-alobakin@pm.me> References: <20210111182655.12159-1-alobakin@pm.me> <20210111182801.12609-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 Instead of unconditional queueing of ready-to-consume skbuff_heads to flush_skb_cache, feed skb_cache with them instead if it's not full already. This greatly reduces the frequency of kmem_cache_alloc_bulk() calls. Signed-off-by: Alexander Lobakin --- net/core/skbuff.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 57a7307689f3..ba0d5611635e 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -904,6 +904,11 @@ static inline void _kfree_skb_defer(struct sk_buff *sk= b) =09/* drop skb->head and call any destructors for packet */ =09skb_release_all(skb); =20 +=09if (nc->skb_count < NAPI_SKB_CACHE_SIZE) { +=09=09nc->skb_cache[nc->skb_count++] =3D skb; +=09=09return; +=09} + =09/* record skb to CPU local list */ =09nc->flush_skb_cache[nc->flush_skb_count++] =3D skb; =20 --=20 2.30.0