mirror of
https://github.com/torvalds/linux
synced 2024-11-05 18:23:50 +00:00
4fd06bd2dc
The -G/--cgroup-filter is to limit lock contention collection on the tasks in the specific cgroups only. $ sudo ./perf lock con -abt -G /user.slice/.../vte-spawn-52221fb8-b33f-4a52-b5c3-e35d1e6fc0e0.scope \ ./perf bench sched messaging # Running 'sched/messaging' benchmark: # 20 sender and receiver processes per group # 10 groups == 400 processes run Total time: 0.174 [sec] contended total wait max wait avg wait pid comm 4 114.45 us 60.06 us 28.61 us 214847 sched-messaging 2 111.40 us 60.84 us 55.70 us 214848 sched-messaging 2 106.09 us 59.42 us 53.04 us 214837 sched-messaging 1 81.70 us 81.70 us 81.70 us 214709 sched-messaging 68 78.44 us 6.83 us 1.15 us 214633 sched-messaging 69 73.71 us 2.69 us 1.07 us 214632 sched-messaging 4 72.62 us 60.83 us 18.15 us 214850 sched-messaging 2 71.75 us 67.60 us 35.88 us 214840 sched-messaging 2 69.29 us 67.53 us 34.65 us 214804 sched-messaging 2 69.00 us 68.23 us 34.50 us 214826 sched-messaging ... Export cgroup__new() function as it's needed from outside. Reviewed-by: Ian Rogers <irogers@google.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Hao Luo <haoluo@google.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Song Liu <song@kernel.org> Cc: bpf@vger.kernel.org Link: https://lore.kernel.org/r/20230906174903.346486-5-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
59 lines
1.6 KiB
C
59 lines
1.6 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef __CGROUP_H__
|
|
#define __CGROUP_H__
|
|
|
|
#include <linux/compiler.h>
|
|
#include <linux/refcount.h>
|
|
#include <linux/rbtree.h>
|
|
#include "util/env.h"
|
|
|
|
struct option;
|
|
|
|
struct cgroup {
|
|
struct rb_node node;
|
|
u64 id;
|
|
char *name;
|
|
int fd;
|
|
refcount_t refcnt;
|
|
};
|
|
|
|
extern int nr_cgroups; /* number of explicit cgroups defined */
|
|
extern bool cgrp_event_expanded;
|
|
|
|
struct cgroup *cgroup__get(struct cgroup *cgroup);
|
|
void cgroup__put(struct cgroup *cgroup);
|
|
|
|
struct evlist;
|
|
struct rblist;
|
|
|
|
struct cgroup *cgroup__new(const char *name, bool do_open);
|
|
struct cgroup *evlist__findnew_cgroup(struct evlist *evlist, const char *name);
|
|
int evlist__expand_cgroup(struct evlist *evlist, const char *cgroups,
|
|
struct rblist *metric_events, bool open_cgroup);
|
|
|
|
void evlist__set_default_cgroup(struct evlist *evlist, struct cgroup *cgroup);
|
|
|
|
int parse_cgroups(const struct option *opt, const char *str, int unset);
|
|
|
|
struct cgroup *cgroup__findnew(struct perf_env *env, uint64_t id,
|
|
const char *path);
|
|
struct cgroup *cgroup__find(struct perf_env *env, uint64_t id);
|
|
struct cgroup *__cgroup__find(struct rb_root *root, uint64_t id);
|
|
|
|
void perf_env__purge_cgroups(struct perf_env *env);
|
|
|
|
#ifdef HAVE_FILE_HANDLE
|
|
int read_cgroup_id(struct cgroup *cgrp);
|
|
#else
|
|
static inline int read_cgroup_id(struct cgroup *cgrp __maybe_unused)
|
|
{
|
|
return -1;
|
|
}
|
|
#endif /* HAVE_FILE_HANDLE */
|
|
|
|
/* read all cgroups in the system and save them in the rbtree */
|
|
void read_all_cgroups(struct rb_root *root);
|
|
|
|
int cgroup_is_v2(const char *subsys);
|
|
|
|
#endif /* __CGROUP_H__ */
|