[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200217172311.GP14879@hirez.programming.kicks-ass.net>
Date: Mon, 17 Feb 2020 18:23:11 +0100
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>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...hat.com>,
Namhyung Kim <namhyung@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Randy Dunlap <rdunlap@...radead.org>,
Masahiro Yamada <yamada.masahiro@...ionext.com>,
Shuah Khan <skhan@...uxfoundation.org>,
Krzysztof Kozlowski <krzk@...nel.org>,
Kees Cook <keescook@...omium.org>,
"Paul E. McKenney" <paulmck@...nel.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
Marco Elver <elver@...gle.com>,
Kent Overstreet <kent.overstreet@...il.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Ard Biesheuvel <ardb@...nel.org>,
Gary Hook <Gary.Hook@....com>,
Kan Liang <kan.liang@...ux.intel.com>,
linux-kernel@...r.kernel.org,
Stephane Eranian <eranian@...gle.com>,
Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH v6 3/6] perf: Use min_heap in visit_groups_merge
On Thu, Feb 13, 2020 at 11:51:30PM -0800, Ian Rogers wrote:
>
> - *evt = perf_event_groups_next(*evt);
> + next = perf_event_groups_next(itrs[0]);
> + if (next) {
> + min_heap_pop_push(&event_heap, &next,
> + &perf_min_heap);
> + } else
> + min_heap_pop(&event_heap, &perf_min_heap);
> }
Like this:
@@ -3585,9 +3581,9 @@ static noinline int visit_groups_merge(s
if (ret)
return ret;
- next = perf_event_groups_next(*evt);
- if (next)
- min_heap_pop_push(&event_heap, &next, &perf_min_heap);
+ *evt = perf_event_groups_next(*evt);
+ if (*evt)
+ min_heapify(&event_heap, 0, &perf_min_heap);
else
min_heap_pop(&event_heap, &perf_min_heap);
}
That's an 'obvious' replace and resort and obviates the need for that
weird pop that doesn't return nothing operation.
Powered by blists - more mailing lists