Re: [PATCH v2 2/5] perf: Free aux pages in unmap path

From: Alexander Shishkin
Date: Thu Mar 17 2016 - 09:05:53 EST


Peter Zijlstra <peterz@xxxxxxxxxxxxx> writes:

> On Mon, Mar 14, 2016 at 04:04:44PM +0200, Alexander Shishkin wrote:
>> Peter Zijlstra <peterz@xxxxxxxxxxxxx> writes:
>
>> >> +static void perf_pmu_output_stop(struct perf_event *event)
>> >> +{
>> >> + int cpu, err;
>> >> +
>> >> + /* better be thorough */
>> >> + get_online_cpus();
>> >> +restart:
>> >> + for_each_online_cpu(cpu) {
>> >> + err = cpu_function_call(cpu, __perf_pmu_output_stop, event);
>> >> + if (err)
>> >> + goto restart;
>> >> + }
>> >> + put_online_cpus();
>> >> +}
>> >
>> > This seems wildly overkill, could we not iterate rb->event_list like we
>> > do for the normal buffer?
>>
>> Actually we can. One problem though is that iterating rb::event_list
>> requires rcu read section or irqsafe rb::event_lock and we need to send
>> IPIs.
>
> We should be able to send IPIs with rcu_read_lock() held; doing so with
> IRQs disabled is a bit harder.

Ok, so how about this one instead.