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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5A83C433EF for ; Thu, 9 Jun 2022 15:49:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243225AbiFIPtb (ORCPT ); Thu, 9 Jun 2022 11:49:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236467AbiFIPta (ORCPT ); Thu, 9 Jun 2022 11:49:30 -0400 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4418C10789B for ; Thu, 9 Jun 2022 08:49:29 -0700 (PDT) Received: by mail-ed1-x533.google.com with SMTP id h19so31808653edj.0 for ; Thu, 09 Jun 2022 08:49:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=3OhCiSaVtT7PzOt/+N9WARlegY6/nQxckbmVX3EBXzw=; b=Yrn1SM70gINJwTXekRwIHZyoXYUfYA9MQgEUvyt4//S3iIKz4gs8/fPq2SuwZtcEip OYPzREzRFkIt6/INCBOcTHn2N/tMmAX/hLqfpy+VvFNOAiJYeh09w1/JP0YHbofQSYtC YAav+BLYMhioXaOwDrcBkYFG6JWHRbx0eZS82hDeEVfSaA/Z5PIN5kOzs+74/u7pPDUr fcepX6ZmpPpAUWqCM+gtUpaoD/EgteNvM9YBiUxOLOWcNrCJpI8aJUuFNfyBuxiwnuRt VE7hm5F6/Q0zT5j2VFwsC25cMCAYPJQEaeSsBXCgBj/ReUl/qgTc57fdGRKjUcyNPESI ugcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=3OhCiSaVtT7PzOt/+N9WARlegY6/nQxckbmVX3EBXzw=; b=olSN2wlaQN9kcbfm2sUDq+zhCnvnm489aujASfm/023usXnLRcETJjNoZj05QMcCbx Uy8FM1icvLinnrYQbvtaJK7WJuWt8mUaSC+raXddLfWQF2szAp5H1aHeZBku4RCT7FL/ a7EFtAGofd1cGWqj7K+brWSnoX/iJFRD8ibFPraz03LVha46Pr5/cZBQsucg6xlJMBCF o82uR7WhX25f9GJsY/y56ABT9l5MiesuDWnvbAWbjUa/MYOey2AMa/jRihI820eO9Ete GGYOdGZFJ+4GW/gotqE3kTV+1OwprOnzA/C3DIYZgcuFLLCnh8x5bvvfAlKGz+BSoGo7 CrnQ== X-Gm-Message-State: AOAM531f8rtZ0XEM0DCsoOpT8LIbFVmVQu3nYLWZL1NEfYR7wlvjKP+/ r0oVg1ZvS95aT2ru71XM6xbxHOO5dVWiQ9xBExk= X-Google-Smtp-Source: ABdhPJxPO4OWX+ToybIoWqe0Vfaxm6C2bzCCxst3F02Bj3kLoEwMi+ZGlVffRwt3AgDTaxn8LvnTMP8n9BiWkbQS9xk= X-Received: by 2002:a05:6402:56:b0:431:6f7b:533 with SMTP id f22-20020a056402005600b004316f7b0533mr21202063edu.333.1654789767805; Thu, 09 Jun 2022 08:49:27 -0700 (PDT) MIME-Version: 1.0 References: <20220604222006.3006708-1-davemarchevsky@fb.com> <20220608230226.jywist5cdgu3ntss@kafai-mbp> <79b4e95c-437d-45c5-c7a8-c077f692c18a@fb.com> In-Reply-To: <79b4e95c-437d-45c5-c7a8-c077f692c18a@fb.com> From: Alexei Starovoitov Date: Thu, 9 Jun 2022 08:49:15 -0700 Message-ID: Subject: Re: [PATCH v5 bpf-next] selftests/bpf: Add benchmark for local_storage get To: Dave Marchevsky Cc: Martin KaFai Lau , bpf , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Kernel Team Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Thu, Jun 9, 2022 at 7:27 AM Dave Marchevsky wrote: > >> + > >> + if (use_hashmap) { > >> + idx = bpf_get_prandom_u32() % hashmap_num_keys; > >> + bpf_map_lookup_elem(inner_map, &idx); > > Is the hashmap populated ? > > > > Nope. Do you expect this to make a difference? Will try when confirming key / > val size above. Martin brought up an important point. The map should be populated. If the map is empty lookup_nulls_elem_raw() will select a bucket, it will be empty and it will return NULL. Whereas the more accurates apples to apples comparison would be to find a task in a map, since bpf_task_storage_get(,F_CREATE); will certainly find it. Then if (l->hash == hash && !memcmp ... will be triggered. When we're counting nsecs that should be noticeable.