]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - kernel/perf_event.c
perf_events: Fix event scheduling issues introduced by transactional API
[net-next-2.6.git] / kernel / perf_event.c
index 10a1aee2309e2d7b63ccb3fb72b950a18b13fb32..42a0e9191af5418b55b7c96ace44b8e0c75705f5 100644 (file)
@@ -687,8 +687,11 @@ group_sched_in(struct perf_event *group_event,
        if (txn)
                pmu->start_txn(pmu);
 
-       if (event_sched_in(group_event, cpuctx, ctx))
+       if (event_sched_in(group_event, cpuctx, ctx)) {
+               if (txn)
+                       pmu->cancel_txn(pmu);
                return -EAGAIN;
+       }
 
        /*
         * Schedule in siblings as one group (if any):
@@ -710,9 +713,6 @@ group_sched_in(struct perf_event *group_event,
        }
 
 group_error:
-       if (txn)
-               pmu->cancel_txn(pmu);
-
        /*
         * Groups can be scheduled in as one unit only, so undo any
         * partial group before returning:
@@ -724,6 +724,9 @@ group_error:
        }
        event_sched_out(group_event, cpuctx, ctx);
 
+       if (txn)
+               pmu->cancel_txn(pmu);
+
        return -EAGAIN;
 }