mirror of
https://github.com/torvalds/linux.git
synced 2026-10-08 03:26:02 +02:00
Switch loops within dsos.c, add a version that isn't locked. Switch some unlocked loops to hold the read lock. Signed-off-by: Ian Rogers <irogers@google.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Anne Macedo <retpolanne@posteo.net> Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com> Cc: Ben Gainey <ben.gainey@arm.com> Cc: Changbin Du <changbin.du@huawei.com> Cc: Chengen Du <chengen.du@canonical.com> Cc: Colin Ian King <colin.i.king@gmail.com> Cc: Ilkka Koskinen <ilkka@os.amperecomputing.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: James Clark <james.clark@arm.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: K Prateek Nayak <kprateek.nayak@amd.com> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Leo Yan <leo.yan@linux.dev> Cc: Li Dong <lidong@vivo.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Markus Elfring <Markus.Elfring@web.de> Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paran Lee <p4ranlee@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Ravi Bangoria <ravi.bangoria@amd.com> Cc: Song Liu <song@kernel.org> Cc: Sun Haiyong <sunhaiyong@loongson.cn> Cc: Thomas Richter <tmricht@linux.ibm.com> Cc: Yang Jihong <yangjihong1@huawei.com> Cc: Yanteng Si <siyanteng@loongson.cn> Cc: Yicong Yang <yangyicong@hisilicon.com> Cc: zhaimingbing <zhaimingbing@cmss.chinamobile.com> Link: https://lore.kernel.org/r/20240410064214.2755936-6-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
55 lines
1.6 KiB
C
55 lines
1.6 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef __PERF_DSOS
|
|
#define __PERF_DSOS
|
|
|
|
#include <stdbool.h>
|
|
#include <stdio.h>
|
|
#include <linux/list.h>
|
|
#include <linux/rbtree.h>
|
|
#include "rwsem.h"
|
|
|
|
struct dso;
|
|
struct dso_id;
|
|
struct kmod_path;
|
|
struct machine;
|
|
|
|
/*
|
|
* DSOs are put into both a list for fast iteration and rbtree for fast
|
|
* long name lookup.
|
|
*/
|
|
struct dsos {
|
|
struct list_head head;
|
|
struct rb_root root; /* rbtree root sorted by long name */
|
|
struct rw_semaphore lock;
|
|
};
|
|
|
|
void dsos__init(struct dsos *dsos);
|
|
void dsos__exit(struct dsos *dsos);
|
|
|
|
void __dsos__add(struct dsos *dsos, struct dso *dso);
|
|
void dsos__add(struct dsos *dsos, struct dso *dso);
|
|
struct dso *__dsos__addnew(struct dsos *dsos, const char *name);
|
|
struct dso *dsos__find(struct dsos *dsos, const char *name, bool cmp_short);
|
|
|
|
struct dso *dsos__findnew_id(struct dsos *dsos, const char *name, struct dso_id *id);
|
|
|
|
bool dsos__read_build_ids(struct dsos *dsos, bool with_hits);
|
|
|
|
struct dso *__dsos__findnew_link_by_longname_id(struct rb_root *root, struct dso *dso,
|
|
const char *name, struct dso_id *id);
|
|
|
|
size_t dsos__fprintf_buildid(struct dsos *dsos, FILE *fp,
|
|
bool (skip)(struct dso *dso, int parm), int parm);
|
|
size_t dsos__fprintf(struct dsos *dsos, FILE *fp);
|
|
|
|
int dsos__hit_all(struct dsos *dsos);
|
|
|
|
struct dso *dsos__findnew_module_dso(struct dsos *dsos, struct machine *machine,
|
|
struct kmod_path *m, const char *filename);
|
|
|
|
struct dso *dsos__find_kernel_dso(struct dsos *dsos);
|
|
|
|
int dsos__for_each_dso(struct dsos *dsos, int (*cb)(struct dso *dso, void *data), void *data);
|
|
|
|
#endif /* __PERF_DSOS */
|