From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 156E9C433E0 for ; Thu, 18 Jun 2020 21:49:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E0C64208D5 for ; Thu, 18 Jun 2020 21:49:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="n2qOA+/M" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731425AbgFRVtB (ORCPT ); Thu, 18 Jun 2020 17:49:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727109AbgFRVtA (ORCPT ); Thu, 18 Jun 2020 17:49:00 -0400 Received: from mail-lj1-x241.google.com (mail-lj1-x241.google.com [IPv6:2a00:1450:4864:20::241]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE447C06174E; Thu, 18 Jun 2020 14:48:59 -0700 (PDT) Received: by mail-lj1-x241.google.com with SMTP id x18so9121405lji.1; Thu, 18 Jun 2020 14:48:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Q3SW089VJRQgJW9cl/e2kwpOjXCjLnxzYVYyNM7K6i8=; b=n2qOA+/MUC8heWEYdwM9XoyNyQNGs7lYb5wS/S/AI2Lx3K/J6QaeQ0lGlPtr7jx2q4 u0M3xJxNsgK/k4GMAaDak5Zifay8CxEY/KtSucgOqetKCzoqDsqIzug0xMiSuXUuqr6P g2O9SHbgC9a8DocgLHSe6ZiihxQ++2p0hc1smtchmtS0CswwXpjxm2iZ4+Ol5uvDZdY4 jgt6Ttt2cZE97tusxQr+l107GMKYtWA+GqrmBYf2DROfpnYbp6sTQ87mEd0mE7oJ8JU3 TKTapccQc4s42u5ArBhNTSDM6jEqobZ2+cGh2V9r7XV2/dCTs7osz/eGVzTy+miMOWMb JpAA== 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=Q3SW089VJRQgJW9cl/e2kwpOjXCjLnxzYVYyNM7K6i8=; b=gbntNg9qe9WFGm2MzJCWMpAqC6c92nnoqfBnDe8XyL9oOSM2WqsYc0bi0ASx4Z26iY rcDoyKjJWtoLxlZP/qA0WRkpkMtjyCP5k1uOfmmd8t7CFUpTfaMcmDq+x5YfmQLHuau2 qaNyj716BWeM92otxtwizk51zuqtNh7J6dc3EP4FWDJ+Pd0JHmFleRnoI7niOQ0BlCQx m0a1ZUfH03U531B/q3uED4SRqtO1J7ZsyWuIY8kYEP/kA+DJ2DqTQE7gCH6rJnjmI4Dj OMR40zJ08nWVFlLSXWLP3nE6WBWxk2O449jgZTVo3Fwy5vb0eOOB8S7gp3VGwNKY8q8w t94g== X-Gm-Message-State: AOAM533piTA2fR0TaYsRdKZSjDqTBm4jeUU7ADdqXnX9bb/1E2nP6/1M UHGINBRY/nSmI9jSEDbXmqUKLsDWktf0WBBveCc= X-Google-Smtp-Source: ABdhPJwDLhJjOmZvAlLjeFBaZznMgbfHXpEz0LjAkaV22GeUBWzaN1Up0oSQbnBc45YrHKuwwtXoiCYed/DjndgEg60= X-Received: by 2002:a05:651c:1193:: with SMTP id w19mr214793ljo.121.1592516938204; Thu, 18 Jun 2020 14:48:58 -0700 (PDT) MIME-Version: 1.0 References: <20200617174226.2301909-1-kafai@fb.com> <5eeaf50fec904_38b82b28075185c44c@john-XPS-13-9370.notmuch> In-Reply-To: <5eeaf50fec904_38b82b28075185c44c@john-XPS-13-9370.notmuch> From: Alexei Starovoitov Date: Thu, 18 Jun 2020 14:48:46 -0700 Message-ID: Subject: Re: [PATCH bpf-next] bpf: sk_storage: Prefer to get a free cache_idx To: John Fastabend Cc: Martin KaFai Lau , bpf , Alexei Starovoitov , Daniel Borkmann , Kernel Team , Network Development Content-Type: text/plain; charset="UTF-8" Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Wed, Jun 17, 2020 at 10:01 PM John Fastabend wrote: > > Martin KaFai Lau wrote: > > The cache_idx is currently picked by RR. There is chance that > > the same cache_idx will be picked by multiple sk_storage_maps while > > other cache_idx is still unused. e.g. It could happen when the > > sk_storage_map is recreated during the restart of the user > > space process. > > > > This patch tracks the usage count for each cache_idx. There is > > 16 of them now (defined in BPF_SK_STORAGE_CACHE_SIZE). > > It will try to pick the free cache_idx. If none was found, > > it would pick one with the minimal usage count. > > > > Signed-off-by: Martin KaFai Lau > > --- > > net/core/bpf_sk_storage.c | 41 +++++++++++++++++++++++++++++++++++---- > > 1 file changed, 37 insertions(+), 4 deletions(-) > > > > Acked-by: John Fastabend Applied. Thanks