Re: [RFC 2/2] perf: update userspace page info for software event

From: Peter Zijlstra
Date: Fri Jan 23 2015 - 03:45:02 EST


On Thu, Jan 22, 2015 at 01:09:02PM -0800, Shaohua Li wrote:
> ---
> kernel/events/core.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index 4edde3e..4221240 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -5950,6 +5950,7 @@ static int perf_swevent_add(struct perf_event *event, int flags)
> }
>
> hlist_add_head_rcu(&event->hlist_entry, head);
> + perf_event_update_userpage(event);
>
> return 0;
> }
> @@ -6419,6 +6420,7 @@ static int cpu_clock_event_add(struct perf_event *event, int flags)
> {
> if (flags & PERF_EF_START)
> cpu_clock_event_start(event, flags);
> + perf_event_update_userpage(event);
>
> return 0;
> }
> @@ -6493,6 +6495,7 @@ static int task_clock_event_add(struct perf_event *event, int flags)
> {
> if (flags & PERF_EF_START)
> task_clock_event_start(event, flags);
> + perf_event_update_userpage(event);
>
> return 0;
> }

How about the one I sent; which adds it to {start,stop} instead of add?
{start,stop} is the right place to add them, although this add might be
sufficient for your use case.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/