aboutsummaryrefslogtreecommitdiff
path: root/idlestat.h
diff options
context:
space:
mode:
authorTuukka Tikkanen <tuukka.tikkanen@linaro.org>2014-12-03 16:03:28 +0200
committerTuukka Tikkanen <tuukka.tikkanen@linaro.org>2014-12-05 09:52:39 +0200
commit6b7a59e14e5b116959ae3eb264b42ed700e20d1a (patch)
tree7e9ae11a9cef2c180f9fa7920fd7f07d4fc42bba /idlestat.h
parent4b3a7cc81053c2ac93d9ea784d603ec56239fae7 (diff)
Idlestat: Plug memory leaks from inter() and topology
Function inter() may return newly allocated structures or one of the parameters (if the other parameter is NULL). This function is called in a loop from cluster_data(), core_cluster_data() and physical_cluster_data() with one of the parameters often being an earlier return value from inter(). This causes a great number of structure allocations without matching memory releases. Code in topology.c takes the result from *_cluster_data(), but it only releases the top-level structure, without releasing the data pointed to by top-level structure members. This patch plugs both types of leaks. Since the memory pointed to by inter() may or may not be allocated by that call, a new member has been added to struct cpuidle_cstate to indicate the origin of the structure. This patch also adds detection for data aliasing related to inter(), but does not remove the bug. Signed-off-by: Tuukka Tikkanen <tuukka.tikkanen@linaro.org>
Diffstat (limited to 'idlestat.h')
-rw-r--r--idlestat.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/idlestat.h b/idlestat.h
index a32aab9..253d2b9 100644
--- a/idlestat.h
+++ b/idlestat.h
@@ -63,6 +63,7 @@ struct cpuidle_cstate {
double min_time;
double duration;
int target_residency; /* -1 if not available */
+ int inter_result; /* 1 if created by a call to inter() */
};
struct wakeup_irq {
@@ -87,6 +88,8 @@ struct cpuidle_cstates {
enum {as_expected, too_long, too_short} actual_residency;
};
+extern void release_cstate_info(struct cpuidle_cstates *cstates, int nrcpus);
+
struct cpufreq_pstate {
int id;
unsigned int freq;