aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/perf_counter.c38
1 files changed, 13 insertions, 25 deletions
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 29b685f551aa..109a95723859 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -1283,7 +1283,7 @@ static void perf_ctx_adjust_freq(struct perf_counter_context *ctx)
1283 if (!interrupts) { 1283 if (!interrupts) {
1284 perf_disable(); 1284 perf_disable();
1285 counter->pmu->disable(counter); 1285 counter->pmu->disable(counter);
1286 atomic_set(&hwc->period_left, 0); 1286 atomic64_set(&hwc->period_left, 0);
1287 counter->pmu->enable(counter); 1287 counter->pmu->enable(counter);
1288 perf_enable(); 1288 perf_enable();
1289 } 1289 }
@@ -1553,7 +1553,7 @@ static int perf_release(struct inode *inode, struct file *file)
1553static ssize_t 1553static ssize_t
1554perf_read_hw(struct perf_counter *counter, char __user *buf, size_t count) 1554perf_read_hw(struct perf_counter *counter, char __user *buf, size_t count)
1555{ 1555{
1556 u64 values[3]; 1556 u64 values[4];
1557 int n; 1557 int n;
1558 1558
1559 /* 1559 /*
@@ -1620,22 +1620,6 @@ static void perf_counter_reset(struct perf_counter *counter)
1620 perf_counter_update_userpage(counter); 1620 perf_counter_update_userpage(counter);
1621} 1621}
1622 1622
1623static void perf_counter_for_each_sibling(struct perf_counter *counter,
1624 void (*func)(struct perf_counter *))
1625{
1626 struct perf_counter_context *ctx = counter->ctx;
1627 struct perf_counter *sibling;
1628
1629 WARN_ON_ONCE(ctx->parent_ctx);
1630 mutex_lock(&ctx->mutex);
1631 counter = counter->group_leader;
1632
1633 func(counter);
1634 list_for_each_entry(sibling, &counter->sibling_list, list_entry)
1635 func(sibling);
1636 mutex_unlock(&ctx->mutex);
1637}
1638
1639/* 1623/*
1640 * Holding the top-level counter's child_mutex means that any 1624 * Holding the top-level counter's child_mutex means that any
1641 * descendant process that has inherited this counter will block 1625 * descendant process that has inherited this counter will block
@@ -1658,14 +1642,18 @@ static void perf_counter_for_each_child(struct perf_counter *counter,
1658static void perf_counter_for_each(struct perf_counter *counter, 1642static void perf_counter_for_each(struct perf_counter *counter,
1659 void (*func)(struct perf_counter *)) 1643 void (*func)(struct perf_counter *))
1660{ 1644{
1661 struct perf_counter *child; 1645 struct perf_counter_context *ctx = counter->ctx;
1646 struct perf_counter *sibling;
1662 1647
1663 WARN_ON_ONCE(counter->ctx->parent_ctx); 1648 WARN_ON_ONCE(ctx->parent_ctx);
1664 mutex_lock(&counter->child_mutex); 1649 mutex_lock(&ctx->mutex);
1665 perf_counter_for_each_sibling(counter, func); 1650 counter = counter->group_leader;
1666 list_for_each_entry(child, &counter->child_list, child_list) 1651
1667 perf_counter_for_each_sibling(child, func); 1652 perf_counter_for_each_child(counter, func);
1668 mutex_unlock(&counter->child_mutex); 1653 func(counter);
1654 list_for_each_entry(sibling, &counter->sibling_list, list_entry)
1655 perf_counter_for_each_child(counter, func);
1656 mutex_unlock(&ctx->mutex);
1669} 1657}
1670 1658
1671static int perf_counter_period(struct perf_counter *counter, u64 __user *arg) 1659static int perf_counter_period(struct perf_counter *counter, u64 __user *arg)