Messages in this thread | | | Date | Tue, 6 Mar 2018 09:54:36 +0100 | From | Peter Zijlstra <> | Subject | Re: [PATCH] perf: correct ctx_event_type in ctx_resched() |
| |
On Mon, Mar 05, 2018 at 09:55:04PM -0800, Song Liu wrote: > In ctx_resched(), EVENT_FLEXIBLE should be sched_out when EVENT_PINNED is > added. However, ctx_resched() calculates ctx_event_type before checking > this condition. As a result, pinned events will NOT get higher priority > than flexible events. > > The following shows this issue on an Intel CPU (where ref-cycles can > only use one hardware counter). > > 1. First start: > perf stat -C 0 -e ref-cycles -I 1000 > 2. Then, in the second console, run: > perf stat -C 0 -e ref-cycles:D -I 1000 > > The second perf uses pinned events, which is expected to have higher > priority. However, because it failed in ctx_resched(). It is never > run. > > This patch fixes this by calculating ctx_event_type after re-evaluating > event_type. > > Fixes: 487f05e18aa4 ("perf/core: Optimize event rescheduling on active contexts") > Signed-off-by: Song Liu <songliubraving@fb.com> > Reported-by: Ephraim Park <ephiepark@fb.com>
Thanks!
| |