- Plug a memory leak: free up per-cpu sample buffers at module unload time.
- Correct a few style nits.
This commit is contained in:
parent
758de8f2ef
commit
9bad87d165
@ -3954,7 +3954,8 @@ pmc_initialize(void)
|
||||
}
|
||||
|
||||
if (pmc_nsamples <= 0 || pmc_nsamples > 65535) {
|
||||
(void) printf("hwpmc: tunable nsamples=%d out of range.\n", pmc_nsamples);
|
||||
(void) printf("hwpmc: tunable nsamples=%d out of range.\n",
|
||||
pmc_nsamples);
|
||||
pmc_nsamples = PMC_NSAMPLES;
|
||||
}
|
||||
|
||||
@ -3995,8 +3996,7 @@ pmc_initialize(void)
|
||||
M_WAITOK|M_ZERO);
|
||||
|
||||
sb->ps_read = sb->ps_write = sb->ps_samples;
|
||||
sb->ps_fence = sb->ps_samples + pmc_nsamples
|
||||
;
|
||||
sb->ps_fence = sb->ps_samples + pmc_nsamples;
|
||||
KASSERT(pmc_pcpu[cpu] != NULL,
|
||||
("[pmc,%d] cpu=%d Null per-cpu data", __LINE__, cpu));
|
||||
|
||||
@ -4147,6 +4147,17 @@ pmc_cleanup(void)
|
||||
KASSERT(pmc_ss_count == 0,
|
||||
("[pmc,%d] Global SS count not empty", __LINE__));
|
||||
|
||||
/* free the per-cpu sample buffers */
|
||||
for (cpu = 0; cpu < mp_ncpus; cpu++) {
|
||||
if (pmc_cpu_is_disabled(cpu))
|
||||
continue;
|
||||
KASSERT(pmc_pcpu[cpu]->pc_sb != NULL,
|
||||
("[pmc,%d] Null cpu sample buffer cpu=%d", __LINE__,
|
||||
cpu));
|
||||
FREE(pmc_pcpu[cpu]->pc_sb, M_PMC);
|
||||
pmc_pcpu[cpu]->pc_sb = NULL;
|
||||
}
|
||||
|
||||
/* do processor dependent cleanup */
|
||||
PMCDBG(MOD,INI,3, "%s", "md cleanup");
|
||||
if (md) {
|
||||
|
Loading…
Reference in New Issue
Block a user