Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp853735ybk; Fri, 15 May 2020 15:43:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDCwJdwDKhl3LbYmo0It5HoUx8AMw6nlZ/1c/xx2FxtaCZXUkrYsjUR5+7xe9td7gAHzmU X-Received: by 2002:aa7:dcd7:: with SMTP id w23mr5113061edu.300.1589582628276; Fri, 15 May 2020 15:43:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589582628; cv=none; d=google.com; s=arc-20160816; b=QgY1dznubOJDw+WlKU6/2OHTvlGsXsk1PS6x4pP70ocDeW+d96ofdiPT3qySDbHyL8 bUF9FbhSl2xUr611h2TEHjYjaRDlgIoWAPWTV9beblPo4TCripQruX8CxyfPL5J/ToGR rxmy6+wNeleCTBMgQRA/StM/H+tlKmB3dKrSbH4yUNfQaCprVRMeWobygbsyeoucjy/E 1/mEojK37QwOAJ0VV6PSV61707rhbpNM6WpSyteQ91ANuPEVqywlazyKICE+nzIT9xAu iN2HK2ou0yCbkpteX/IDIHfg99ke/bRzrshnDNQaTzfk4mmvmMlZeEUtljToCEx95sMe Iv0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=UL8fOqZTfdv9oaZOkGUT1dwItLiG3P0x4wkHssJgnAs=; b=vUiuVsZh/kzX16N7cE3Kl7dL/WUgpeQ2+KXD+v1x2ahorUTMAmCfyWLjF9cSLXAp4F I7Pw78WPg2BMw8KVxHQBVYK1PpuInH997HpFXNstysL7gte1cR7cWlSCq15V4JAzwgpo I7qvB0r18oQCiDnPX/7cDsiwxgvFXA9rguK0OcyUatdfSm+/2Lzc+CExTFNBfx/X9yhq krhidAwZMSnMMym77nohTICFrZKCzwaX4hvI1GoI/B9vbzt6hpSiXkL2WgMrd1C75e84 Bdr7oRa74VjlZrxeumTn0X3sjhsZpfYaKUuXHxuJ7PArRwl/7xkZk9pQKhM/rtyUzBX8 PUtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YG2IKlNX; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o21si2170302ejg.500.2020.05.15.15.43.24; Fri, 15 May 2020 15:43:48 -0700 (PDT) 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=@redhat.com header.s=mimecast20190719 header.b=YG2IKlNX; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726550AbgEOWlz (ORCPT + 99 others); Fri, 15 May 2020 18:41:55 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:40167 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726212AbgEOWly (ORCPT ); Fri, 15 May 2020 18:41:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589582513; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=UL8fOqZTfdv9oaZOkGUT1dwItLiG3P0x4wkHssJgnAs=; b=YG2IKlNXKGGESBWlpBg+YAYyaOLyKs0cjZBl7IJYFlfnMEKflGox/nifPhbihgppsoNcxO VqIrUXp7TR8yjd3ekq3DTlyQGOa2rKos6PNWkFkMoFES1vLQno5NsedfQ6FkG3iqb6UT8O BsYrUKcOqjHsgXyWXnHxJCosRDhNl5Q= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-466-Sv82uqk7PmSG4lAKL9NIow-1; Fri, 15 May 2020 18:41:49 -0400 X-MC-Unique: Sv82uqk7PmSG4lAKL9NIow-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D39D7107ACCD; Fri, 15 May 2020 22:41:45 +0000 (UTC) Received: from krava (unknown [10.40.192.69]) by smtp.corp.redhat.com (Postfix) with SMTP id 35F945D9C9; Fri, 15 May 2020 22:41:40 +0000 (UTC) Date: Sat, 16 May 2020 00:41:39 +0200 From: Jiri Olsa To: Ian Rogers Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Namhyung Kim , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , Andrii Nakryiko , John Fastabend , KP Singh , Kajol Jain , Andi Kleen , John Garry , Jin Yao , Kan Liang , Cong Wang , Kim Phillips , Adrian Hunter , Leo Yan , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, Stephane Eranian Subject: Re: [PATCH v2 7/7] perf expr: Migrate expr ids table to a hashmap Message-ID: <20200515224139.GB3577540@krava> References: <20200515165007.217120-1-irogers@google.com> <20200515165007.217120-8-irogers@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200515165007.217120-8-irogers@google.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 15, 2020 at 09:50:07AM -0700, Ian Rogers wrote: SNIP > diff --git a/tools/perf/util/expr.c b/tools/perf/util/expr.c > index 8b4ce704a68d..f64ab91c432b 100644 > --- a/tools/perf/util/expr.c > +++ b/tools/perf/util/expr.c > @@ -4,25 +4,76 @@ > #include "expr.h" > #include "expr-bison.h" > #include "expr-flex.h" > +#include > > #ifdef PARSER_DEBUG > extern int expr_debug; > #endif > > +static size_t key_hash(const void *key, void *ctx __maybe_unused) > +{ > + const char *str = (const char *)key; > + size_t hash = 0; > + > + while (*str != '\0') { > + hash *= 31; > + hash += *str; > + str++; > + } > + return hash; > +} > + > +static bool key_equal(const void *key1, const void *key2, > + void *ctx __maybe_unused) > +{ > + return !strcmp((const char *)key1, (const char *)key2); should that be strcasecmp ? would it affect the key_hash as well? jirka