[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190807211143.GA15727@worktop.programming.kicks-ass.net>
Date: Wed, 7 Aug 2019 23:11:43 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Ian Rogers <irogers@...gle.com>
Cc: Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...hat.com>,
Namhyung Kim <namhyung@...nel.org>,
linux-kernel@...r.kernel.org,
Kan Liang <kan.liang@...ux.intel.com>,
Stephane Eranian <eranian@...gle.com>,
Mark Rutland <mark.rutland@....com>
Subject: Re: [PATCH v2 4/7] perf: avoid a bounded set of visit_groups_merge
iterators
On Wed, Jul 24, 2019 at 03:37:43PM -0700, Ian Rogers wrote:
> @@ -2597,6 +2612,30 @@ static int __perf_install_in_context(void *info)
> struct perf_cgroup *cgrp = perf_cgroup_from_task(current, ctx);
> reprogram = cgroup_is_descendant(cgrp->css.cgroup,
> event->cgrp->css.cgroup);
> +
> + /*
> + * Ensure space for visit_groups_merge iterator storage. With
> + * cgroup profiling we may have an event at each depth plus
> + * system wide events.
> + */
> + max_iterators = perf_event_cgroup_depth(event) + 1;
> + if (max_iterators >
> + cpuctx->visit_groups_merge_iterator_storage_size) {
> + struct perf_event **storage =
> + krealloc(cpuctx->visit_groups_merge_iterator_storage,
> + sizeof(struct perf_event *) * max_iterators,
> + GFP_KERNEL);
> + if (storage) {
> + cpuctx->visit_groups_merge_iterator_storage
> + = storage;
> + cpuctx->visit_groups_merge_iterator_storage_size
> + = max_iterators;
> + } else {
> + WARN_ONCE(1, "Unable to increase iterator "
> + "storage for perf events with cgroups");
> + ret = -ENOMEM;
> + }
> + }
> }
> #endif
This is completely insane and broken. You do not allocate memory from
hardirq context while holding all sorts of locks.
Also, the patches are still an unreadable mess, and they do far too much
in a single patch.
Please have a look at the completely untested lot at:
git://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git perf/cgroup
Powered by blists - more mailing lists