lkml.org 
[lkml]   [2011]   [Apr]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[RFC][PATCH 7/9] perf: Collect the schedule in rules in one function

    Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
    ---
    kernel/perf_event.c | 27 +++++++++++++++------------
    1 file changed, 15 insertions(+), 12 deletions(-)

    Index: linux-2.6/kernel/perf_event.c
    ===================================================================
    --- linux-2.6.orig/kernel/perf_event.c
    +++ linux-2.6/kernel/perf_event.c
    @@ -1483,6 +1483,18 @@ ctx_sched_in(struct perf_event_context *
    enum event_type_t event_type,
    struct task_struct *task);

    +static void perf_event_sched_in(struct perf_cpu_context *cpuctx,
    + struct perf_event_context *ctx,
    + struct task_struct *task)
    +{
    + cpu_ctx_sched_in(cpuctx, EVENT_PINNED, task);
    + if (ctx)
    + ctx_sched_in(ctx, cpuctx, EVENT_PINNED, task);
    + cpu_ctx_sched_in(cpuctx, EVENT_FLEXIBLE, task);
    + if (ctx)
    + ctx_sched_in(ctx, cpuctx, EVENT_FLEXIBLE, task);
    +}
    +
    /*
    * Cross CPU call to install and enable a performance event
    *
    @@ -1530,12 +1542,7 @@ static int __perf_install_in_context(vo
    /*
    * Schedule everything back in
    */
    - cpu_ctx_sched_in(cpuctx, EVENT_PINNED, task);
    - if (task_ctx)
    - ctx_sched_in(task_ctx, cpuctx, EVENT_PINNED, task);
    - cpu_ctx_sched_in(cpuctx, EVENT_FLEXIBLE, task);
    - if (task_ctx)
    - ctx_sched_in(task_ctx, cpuctx, EVENT_FLEXIBLE, task);
    + perf_event_sched_in(cpuctx, task_ctx, task);

    perf_pmu_enable(cpuctx->ctx.pmu);
    perf_ctx_unlock(cpuctx, task_ctx);
    @@ -2114,9 +2121,7 @@ static void perf_event_context_sched_in(
    */
    cpu_ctx_sched_out(cpuctx, EVENT_FLEXIBLE);

    - ctx_sched_in(ctx, cpuctx, EVENT_PINNED, task);
    - cpu_ctx_sched_in(cpuctx, EVENT_FLEXIBLE, task);
    - ctx_sched_in(ctx, cpuctx, EVENT_FLEXIBLE, task);
    + perf_event_sched_in(cpuctx, ctx, task);

    cpuctx->task_ctx = ctx;

    @@ -2354,9 +2359,7 @@ static void perf_rotate_context(struct p
    if (ctx)
    rotate_ctx(ctx);

    - cpu_ctx_sched_in(cpuctx, EVENT_FLEXIBLE, current);
    - if (ctx)
    - ctx_sched_in(ctx, cpuctx, EVENT_FLEXIBLE, current);
    + perf_event_sched_in(cpuctx, ctx, current);

    done:
    if (remove)



    \
     
     \ /
      Last update: 2011-04-09 21:25    [W:0.022 / U:0.424 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site