Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1127537ybe; Fri, 13 Sep 2019 11:27:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqw89loDnk5EKKIpOeJL17PKm1593xuc1lObgyumZ2/PqcsqYpbZsKnTQpVRcXA/91rs0bos X-Received: by 2002:a50:eb4c:: with SMTP id z12mr49729964edp.155.1568399243597; Fri, 13 Sep 2019 11:27:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568399243; cv=none; d=google.com; s=arc-20160816; b=uPgEV4HdXZ9TAySournPof5KziB0CQFzcdnmYbztQqDz7Gt1tR/hfyxyFkL3AtH2T4 /ZMM/uJTAn6C849GIMfTU+RwOU6nQH8XiEJ2EpCiYUtV1YX/U6VL+Pi96HicXKbPrDav kmzgjx4vZpu2h3D296qqkduBiXNAPZH372VHTy9Be3rgePwxPmCaD5EThIBnSdCE9EB5 BPyM/AK/rRavksvVANCve61h6LAGKGKVj82KWYogmXgn0JQ1wJl5YlE+1zSeaRZC51jr iDVBmtRbzipqqAI2JUDjQ+ofA32PphZueuOSt96r4fImfzCe7bpe8LZrssHcrS2myeZQ s8kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=7nfF1Xl6fYnrukYIhqSIYTOlmsqbj/G97L75P8eVhgQ=; b=AA7XUxIQSuFywW2a0gD1V6yJmUmrLrsl8yGXxurRGi27gyh3w9Opdw5VwklgHM8H3F DnV2oRi9PYyYV9j0iAf1WONv6FfaON79nCzTQCSTp5vWjOD3AvojfXyxCGkYyLZxWRRy D9ep9nIsURzuqCF5XiEVWk1QzrhgHUt/WjlF7ucRjJsUMaWSV5m5D3lsbAnSCep75s9a Wuwr0cWCHczSkkKEbEFuvJPKukEhZ9X7F7JSuF5jg0TUburg5MC9JhJV0VpY8MwpyUxb tf5sXWkyYtK9VETdYtl+EiWT2UDaHfaAXlc2mJPWDweLMRPtarqFxCuwn49k/YJxpT2O sJzw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b42si18282682eda.367.2019.09.13.11.27.00; Fri, 13 Sep 2019 11:27:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391300AbfIMNZK (ORCPT + 99 others); Fri, 13 Sep 2019 09:25:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60806 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391289AbfIMNZH (ORCPT ); Fri, 13 Sep 2019 09:25:07 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C444151EE4; Fri, 13 Sep 2019 13:25:06 +0000 (UTC) Received: from krava.brq.redhat.com (unknown [10.43.17.36]) by smtp.corp.redhat.com (Postfix) with ESMTP id ED0935C1D4; Fri, 13 Sep 2019 13:25:03 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan Subject: [PATCH 26/73] libperf: Move heads from struct evlist to struct perf_evlist Date: Fri, 13 Sep 2019 15:23:08 +0200 Message-Id: <20190913132355.21634-27-jolsa@kernel.org> In-Reply-To: <20190913132355.21634-1-jolsa@kernel.org> References: <20190913132355.21634-1-jolsa@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Fri, 13 Sep 2019 13:25:06 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Move heads hash from struct evlist to struct perf_evlist. Link: http://lkml.kernel.org/n/tip-4y1fuw43ave7y32ypc9epthv@git.kernel.org Signed-off-by: Jiri Olsa --- tools/perf/lib/evlist.c | 4 ++++ tools/perf/lib/include/internal/evlist.h | 4 ++++ tools/perf/util/evlist.c | 10 +++------- tools/perf/util/evlist.h | 4 ---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tools/perf/lib/evlist.c b/tools/perf/lib/evlist.c index f4dc9a208332..2bdd9d2c79d9 100644 --- a/tools/perf/lib/evlist.c +++ b/tools/perf/lib/evlist.c @@ -11,6 +11,10 @@ void perf_evlist__init(struct perf_evlist *evlist) { + int i; + + for (i = 0; i < PERF_EVLIST__HLIST_SIZE; ++i) + INIT_HLIST_HEAD(&evlist->heads[i]); INIT_LIST_HEAD(&evlist->entries); evlist->nr_entries = 0; } diff --git a/tools/perf/lib/include/internal/evlist.h b/tools/perf/lib/include/internal/evlist.h index 8a4eb66fbf3a..c5a06890fd6a 100644 --- a/tools/perf/lib/include/internal/evlist.h +++ b/tools/perf/lib/include/internal/evlist.h @@ -5,6 +5,9 @@ #include #include +#define PERF_EVLIST__HLIST_BITS 8 +#define PERF_EVLIST__HLIST_SIZE (1 << PERF_EVLIST__HLIST_BITS) + struct perf_cpu_map; struct perf_thread_map; @@ -17,6 +20,7 @@ struct perf_evlist { int nr_mmaps; size_t mmap_len; struct fdarray pollfd; + struct hlist_head heads[PERF_EVLIST__HLIST_SIZE]; }; /** diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index 9dcecb5e05a0..2f883db7c8e7 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c @@ -54,10 +54,6 @@ int sigqueue(pid_t pid, int sig, const union sigval value); void evlist__init(struct evlist *evlist, struct perf_cpu_map *cpus, struct perf_thread_map *threads) { - int i; - - for (i = 0; i < PERF_EVLIST__HLIST_SIZE; ++i) - INIT_HLIST_HEAD(&evlist->heads[i]); perf_evlist__init(&evlist->core); perf_evlist__set_maps(&evlist->core, cpus, threads); fdarray__init(&evlist->core.pollfd, 64); @@ -474,7 +470,7 @@ static void perf_evlist__id_hash(struct evlist *evlist, sid->id = id; sid->evsel = evsel; hash = hash_64(sid->id, PERF_EVLIST__HLIST_BITS); - hlist_add_head(&sid->node, &evlist->heads[hash]); + hlist_add_head(&sid->node, &evlist->core.heads[hash]); } void perf_evlist__id_add(struct evlist *evlist, struct evsel *evsel, @@ -548,7 +544,7 @@ struct perf_sample_id *perf_evlist__id2sid(struct evlist *evlist, u64 id) int hash; hash = hash_64(id, PERF_EVLIST__HLIST_BITS); - head = &evlist->heads[hash]; + head = &evlist->core.heads[hash]; hlist_for_each_entry(sid, head, node) if (sid->id == id) @@ -634,7 +630,7 @@ struct evsel *perf_evlist__event2evsel(struct evlist *evlist, return first; hash = hash_64(id, PERF_EVLIST__HLIST_BITS); - head = &evlist->heads[hash]; + head = &evlist->core.heads[hash]; hlist_for_each_entry(sid, head, node) { if (sid->id == id) diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h index b8f03452196f..7306a0677171 100644 --- a/tools/perf/util/evlist.h +++ b/tools/perf/util/evlist.h @@ -20,12 +20,8 @@ struct thread_map; struct perf_cpu_map; struct record_opts; -#define PERF_EVLIST__HLIST_BITS 8 -#define PERF_EVLIST__HLIST_SIZE (1 << PERF_EVLIST__HLIST_BITS) - struct evlist { struct perf_evlist core; - struct hlist_head heads[PERF_EVLIST__HLIST_SIZE]; int nr_groups; bool enabled; int id_pos; -- 2.21.0