On Fri, Jan 23, 2015 at 09:44:51AM +0100, Peter Zijlstra wrote:
> 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.
Hi Peter,
I tried {start, stop}, it doesn't work (doesn't get called in context
switch) and I still get a CLOCK_MONOTONIC. So I added it to .add, which
is called in context switch and I got correct thread time. Am I missing
anything?

Thanks,
Shaohua
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to