Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1244632

Re: [RFC PATCH 1/2] perf: Add the flag sample_disable not to output data on samples

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: [RFC PATCH 1/2] perf: Add the flag sample_disable not to output data on samples
Date 2015-10-12 14:10 +0200
Message-ID <qiK5s-6T6-9@gated-at.bofh.it> (permalink)
References <qiHhh-2LN-29@gated-at.bofh.it> <qiHhh-2LN-31@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, Oct 12, 2015 at 09:02:42AM +0000, Kaixu Xia wrote:
> --- a/include/linux/perf_event.h
> +++ b/include/linux/perf_event.h
> @@ -483,6 +483,8 @@ struct perf_event {
>  	perf_overflow_handler_t		overflow_handler;
>  	void				*overflow_handler_context;
>  
> +	atomic_t			*sample_disable;
> +
>  #ifdef CONFIG_EVENT_TRACING
>  	struct trace_event_call		*tp_event;
>  	struct event_filter		*filter;

> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index b11756f..f6ef45c 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -6337,6 +6337,9 @@ static int __perf_event_overflow(struct perf_event *event,
>  		irq_work_queue(&event->pending);
>  	}
>  
> +	if ((event->sample_disable) && atomic_read(event->sample_disable))
> +		return ret;
> +
>  	if (event->overflow_handler)
>  		event->overflow_handler(event, data, regs);
>  	else

Try and guarantee sample_disable lives in the same cacheline as
overflow_handler.

I think we should at the very least replace the kzalloc() currently used
with a cacheline aligned alloc, and check the structure layout to verify
these two do in fact share a cacheline.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC PATCH 1/2] perf: Add the flag sample_disable not to output data on samples Kaixu Xia <xiakaixu@huawei.com> - 2015-10-12 11:10 +0200
  Re: [RFC PATCH 1/2] perf: Add the flag sample_disable not to output  data on samples "Wangnan (F)" <wangnan0@huawei.com> - 2015-10-12 14:10 +0200
    Re: [RFC PATCH 1/2] perf: Add the flag sample_disable not to output  data on samples Peter Zijlstra <peterz@infradead.org> - 2015-10-12 14:20 +0200
  Re: [RFC PATCH 1/2] perf: Add the flag sample_disable not to output  data on samples Peter Zijlstra <peterz@infradead.org> - 2015-10-12 14:10 +0200
  Re: [RFC PATCH 1/2] perf: Add the flag sample_disable not to output  data on samples Alexei Starovoitov <ast@plumgrid.com> - 2015-10-12 21:30 +0200
    Re: [RFC PATCH 1/2] perf: Add the flag sample_disable not to output  data on samples xiakaixu <xiakaixu@huawei.com> - 2015-10-13 04:40 +0200
      Re: [RFC PATCH 1/2] perf: Add the flag sample_disable not to output  data on samples Alexei Starovoitov <ast@plumgrid.com> - 2015-10-13 05:20 +0200
  Re: [RFC PATCH 1/2] perf: Add the flag sample_disable not to output  data on samples Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2015-10-13 14:10 +0200

csiph-web